The term "righteous" as it is used in the Bible has at least three distinct meanings:
Originally Posted by TryTheSpirits
1. Morally good
2. Acceptable to God
3. Pure of heart
When Paul quotes the OT "that there is none righteous", he is quoting verbatim the Septuagint translation of the OT to make his point that all human beings, Jew and Gentile alike, are not "righteous", i.e. morally good enough to merit God's favor.
In the same Epistle of Romans, Paul cites Abraham, whom God declared to be "righteous" in view of his faith. Abraham's faith didn't render him righteous in the first sense, i.e. morally good, it rendered him "righteous" in the second sense, i.e. acceptable to God. God has accepted Abraham, not on a moral basis, but on the basis of Abraham's trusting disposition toward God. Abraham was willing to trust and believe what God said, and so God accepted him on that basis, rather than on a moral basis. Since Abraham is willing to believe and trust what God says, God has nothing against him -- that is, Abraham is right with God.
A major theme in Romans is the comparison between those who attempted to gain God's favor through "righteousness" in the first sense, i.e. acting in moral ways, and those who seek God's favor through righteousness in the second or third sense, i.e. an honest and good heart which leads to contrition. As Paul makes his case he cites the 32nd Psalm in which David points out the difference.
David finds a correspondence between the forgiveness of transgressions and the man in whose spirit there is no deceit. God is willing to forgive an honest man. There is something right and good about a man who is willing to confess his sins and to ask for mercy from God with a contrite heart.
How blessed is he whose transgression is forgiven, Whose sin is covered! How blessed is the man to whom the Lord does not impute iniquity, And in whose spirit there is no deceit!
Paul also cites a passage out of the book of Habakkuk in which God asks the prophet to warn the people by writing the warning on a tablet. God then compares two kinds of people who will respond to the writing,
God refers to the one who believes the warning as "righteous", and he refers to the proud one, that his soul is not right within him. This is righteousness in the third sense, in which a man is declared to be "righteous" when he has the right kind of heart (or soul) that will believe what God says. There is something "right" about that one and something "not right" with the proud one.
I will stand on my guard post and station myself on the rampart; and I will keep watch to see what He will speak to me, and how I may reply when I am reproved. Then the Lord answered me and said, "Record the vision And inscribe it on tablets, that the one who reads it may run. For the vision is yet for the appointed time; It hastens toward the goal and it will not fail. Though it tarries, wait for it; For it will certainly come, it will not delay. Behold, as for the proud one, His soul is not right within him; But the righteous will live by his faith.
For Paul's point in chapter 3, all he needs to prove is that there is none "righteous" in the first sense. That is, there is no person alive (except Jesus) who can merit God's favor through acts of moral goodness.