The Lord is far from the wicked, but He hears the prayer of the righteous. (Proverbs 15:29)
The wicked are those who follow the ways of the "wicked one" instead of the ways of the One who is righteous, Christ. We cannot heed the ways of the enemy of the cross and expect the finished work of the cross to be at our disposal. Therefore the first thing I do when I sense that the Lord is far from my prayers is say with the psalmist, "Search me, O God, and know my heart; Try me, and know my anxieties; and see if there is any wicked way in me, And lead me in the way everlasting." Furthermore I must understand that righteousness is not based on my goodness, but on the goodness of the One who dwells in me, Christ. Without Christ there is none righteous, no not one. Yet I have become the righteousness of God in Christ. Therefore I know that God hears my prayers and that in His perfect timing I will a recipient of His goodness and mercy.