The Bible forbids speaking to the dead, as in spiritually dead, not physically dead. If we were not allowed to speak to those who have died in God’s Grace, Christ Himself would have been sinning at the Transfiguration, when He conversed with Moses and Elijah, who were both physically dead.
So if we’re allowed to speak with them, can we pray to them? First, prayer to the Saints is not asking for them to do something by their own power. It is asking them to pray that God might do something. There is no difference between this and asking a friend to pray for you, as Christ Himself did in the Garden of Gethsemane when He asked His disciples to pray. And who better to get to pray for you than someone who is perfectly attuned to God’s will?