God, in all His holiness and majesty and awesome power, has declared that only the righteous can come into His presence. How can we ever pray the prayer of the righteous so as to be received before the throne of God?
It makes sense, doesn't it? If God is all the Bible tells us, He is absolutely pure and holy - like a white hot light! In fact, He is Light, Truth and Righteousness personified. So even the tiniest speck of sin in us disqualifies us from being anywhere near God. Never mind praying or having a conversation with Him!
Yet we see in a number of Bible passages that God will hear the prayer of the righteous;
The eyes of the LORD are on the righteous and his ears are attentive to their cry; the face of the LORD is against those who do evil, to cut off the memory of them from the earth. The righteous cry out, and the LORD hears them; he delivers them from all their troubles. (Psalm 34:15-17 NIV)
Also in the New Testament:
Therefore confess your sins to each other and pray for each other so that you may be healed. The prayer of a righteous man is powerful and effective. (James 5:16 NIV)
There are a number of other Bible passages such as in the prophet Isaiah's book where God sternly rejects the prayers of those who have sinned. Look up Isaiah 1:16, 59:2, 64:6-7.
Since righteousness is a first requirement for having our prayers answered, we need to first settle how we can become righteous.
The answer is to repent of our sins and receive God's provision of a substitute who has received the full death sentence and impact of punishment for our sins. To repent means to be sorry enough for our sins to admit them, and to confess them to God with a desire to be rid of them forever. To receive God's provision, is to believe the death of God's Son, Jesus Christ, on the cross paid for our sins - for my sins - personally. He did that willingly for the world, or all who would believe, but we must consider it done for you and for me individually too.
When we do that God makes a great spiritual and legal transaction in Heaven. It stands for all time and all eternity. God now considers your sins put on Jesus, and He has already died for them. In return, God puts the righteousness of Jesus on YOU! You can now enter before the throne of God in prayer and God will see you as righteous as He sees His beloved Son, Jesus!
There. It is as simple as that. But it is that very simplicity which often confuses people. They try to make it hard and impossible. Yet, if you have repented of your sins, and received Christ's work on the cross dying for your sins, then you can pray the prayer of the righteous. You may also claim all the promises you find in the Bible for the Righteous!
We base this mainly on the parable Jesus told of the two men who went up to pray in the temple. In Luke 18:9 and on, we see that He addressed this to those who were confident in their own righteousness;
To some who were confident of their own righteousness and looked down on everybody else, Jesus told this parable: "Two men went up to the temple to pray, one a Pharisee and the other a tax collector. The Pharisee stood up and prayed about himself; 'God, I thank you that I am not like all other men - robbers, evildoers, adulterers - or even like this tax collector. I fast twice a week and give a tenth of all I get.'
But the tax collector stood at a distance. He would not even look up to heaven, but beat his breast and said, 'God, have mercy on me, a sinner.'
"I tell you that this man, rather than the other, went home justified before God. For everyone who exalts himself will be humbled, and he who humbles himself will be exalted."
So, if you are not covered in the righteousness of Jesus Christ yet, you can, like the tax collector, pray that one prayer of confession, repentance, and a cry for mercy and forgiveness. It doesn't matter what exact words you use, as long as that is the point you want to make with God. "I'm sorry for my sins! Please have mercy and forgive me!"
God will answer that prayer immediately! Then you can pray more prayers, through the righteousness of your Saviour.