The Epistle to the Romans is Paul's literary masterpiece on the doctrine of salvation. It is the most elegant of his extant writings. Paul begins his piece by presenting the issue of human depravity and righteousness of God. The apostle goes on to show that both Jew and Gentile have broken God's Law and are deserving of His judgement. Everyone stands guilty before Him but He has presented a means of reconciliation through the atoning work of Jesus Christ.
Paul makes an argument by example when he mentions Abraham who lived prior to the Law being given to the people of God. He does this with the intent of showing that his teaching is compatible with the Old Testament. A system of works righteousness would result in boasting. Romans 4:4 says that if someone earns wages, then it is not a gift. But justification is precisely that. Romans 4:5 says that God declares righteous the ungodly and counts them as such by faith.
The Law required that two or three witnesses be present to establish the validity of a charge (Deuteronomy 19:15; Numbers 35:30). Thus, we see the Apostle Paul follow this custom in arguing for justification by faith as opposed to works of the Law when he brings up Abraham and King David. The latter person is of special interest here as we consider how Paul ties in Psalm 32 with his argument. The Psalm in question is one of a penitential nature.
The Psalm used by Paul concerns the feeling of blessedness that comes about as a result of being forgiven of sin by God. The sins King David had repented of were sending Uriah the Hittite into battle to be killed with the intent of covering up his affair with Bathsheba. One sin led him to committing another. David used three words to describe his iniquity: guilt, wrongdoing, and sin. He also used three terms to describe God's mercy: forgiven, covered, and not being taken into account.
It is noteworthy that David did not mention any good deeds done to merit God's favor. In fact, he only brought up his sin. He came to God with nothing and was pardoned for what he had done. Therefore, God justifies people who are ungodly. Forgiveness is a matter of grace. It is not something which we earn. Since David's sin was not imputed to him, that means he had a righteous standing before God.
To be "forgiven" of our sins means that God has taken them away from us. To have our sins "covered" means that their penalty has been met. That leads up to the forgiveness of our sins by God. Romans 4:7 is the only instance in which this word occurs in the New Testament. To have our sins not taken into account means we do not receive condemnation for them in Jesus Christ. We do not merit for ourselves God's eschatological wrath. We are not destined for eternal punishment like unbelievers.
The Apostle Paul uses King David as an example of being justified in spite of his transgressions against God. Both he and Abraham can speak to the reality of justification apart from works. Their experiences are spoken of as equivalent to each other. Romans 4:7 and Romans 4:8 emphasize our pardon from sin. The overall point from these parallel phrases is that we are not justified by works. David speaks of the "blessed man" who receives full pardon from sin, which means he believed others could experience the same.
"...In contrast with many of the rabbinic references to Ps. 32, Paul makes no mention of the confession of sins, which is a central theme of the psalms (cf. Ps. 32:5; see Str-B 3:202-3). Confession is implicitly taken up in faith for Paul, in which sin that has overpowered our person is overcome: in faith "we give glory to God" (4:20; cf. 1:23; 3:26). As was the case with the story of Abraham, the broader context of the psalm makes clear that the "reckoning of righteousness" is no mere declaration, but rather an effective word." (Commentary on the New Testament Use of the Old Testament, edited by G. K. Beale and D. A. Carson, p. 624)