Paul quotes Psalm 51 in Romans 3 where he insists that God’s justice will be upheld even if covenant members are unfaithful. In Psalm 51 the context is David’s confession of sin, and part of the point is that David’s confession is a vindication of God’s justice. In other words, when we confess our sins to God, one of the things we are doing is justifying God, declaring that He is good and just and righteous. Obviously this is not the exact same sort of justification that we receive as sinners. But the parallel is there nevertheless. We confess our sins so that God “may be justified” in His words and “may overcome” when he is judged (Rom. 3:4).
The converse is also true: the refusal to confess our sins to one another and to God is a declaration that God is unjust and unrighteous and unfair. Our refusal to confess our sins is an to attempt to accuse God, to charge God with wrongdoing and injustice. This turns the tables around in terms of our own justification. From this angle, there seems to be a sense in which the reason unrepentant sinners are not justified is because they have refused to justify God. Refusing to declare that God is just, God has in turn refused to declare that they are just.
Of course in the mercy of God, our ability, interest, desire to declare God’s justice is itself the gift of God, lest any man should boast. But Paul says that this was the point of the law, that every mouth may be stopped and the whole world may become guilty before God (Rom. 3:19).