Importantly, David is not claiming to have perfect deeds that could garner pride before God; instead, he refers to the righteousness of his actions in relation to his enemies. He honored God sincerely, maintained true piety, rejected idolatry, and committed himself to obeying God's law. Even when he sinned, he quickly repented and returned wholeheartedly to God. The Lord's words, "No living person will be justified before You" (Psalm 142:2), pertain to those who mistakenly believe they can achieve justification through their own efforts without God's prior grace. Hence, no one can claim justification through personal merit, but those who are righteous by God's grace will indeed be justified.
In this context, David affirms, "Everyone who lives will not be justified before You." Yet, presenting one's innocence before God is not prohibited, as demonstrated by figures such as Nehemiah, Hezekiah, Esau, and David himself.