If I regard wickedness in my heart, the Lord will not hear; but certainly God has heard; He has given heed to the voice of my prayer. Blessed be God, who has not turned away my prayer nor His loving kindness from me.
Your relationship with God must be right if you expect Him to answer your prayers!
When you come into a living relationship with Jesus Christ, your guilt before God is taken away and you begin to relate to Him as His child. You are secure in that relationship with Him as His son or daughter. But as His child your daily fellowship with God is hindered when you disobey Him or resist what He wants to do in your life.
When you become aware of a problem in your fellowship with God, when you know that you need to make things right in the relationship, don't delay. Get the issues out in the open. Talk to God about those things and ask for His forgiveness and restoration of your fellowship with Him. He still loves you as His dear child and wants you to be walking close to Him.
When you make things right with you and God, then you will find that there is such a great confidence in your prayers and an openness in God's response.