Psalms 66:18 If I regard iniquity in my heart, the Lord will not hear me:
Proverbs 15:29 The LORD is far from the wicked: but he heareth the prayer of the righteous.
John 9:31 Now we know that God heareth not sinners: but if any man be a worshipper of God, and doeth his will, him he heareth.
To approach God we must repent of our sinful ways, otherwise God will take no notice of our prayers.
King Saul is an example. He refused to obey the word of God, and was intent on murdering David.
1 Samuel 28:6 And when Saul enquired of the LORD, the LORD answered him not...
I hope this helps.