The Bible tells us when God does not hear our prayers.
"If I regard iniquity (sin) in my heart, the Lord will not hear me": (Psalm 66:18).
To have sinful or wicked thoughts in your heart will not get prayers answered.