That's right, sometimes praying is a waste of your time! In Joshua 7, Israel had lost a fairly easily battle they should have won. They not only lost 36 men but ran with their tails tucked in from the enemy. Joshua took to his knees in prayer and made his complaint and hurt known before the Lord. It is interesting that God tells him to get up! No need to pray until the sin is dealt with in the camp! Achan had concealed items under his tent and God was not blessing Israel because of this transgression. No need to pray until the concealed sin is dealt with the right way! Friend, please don't think you can play around with sin and hide sin from God! Psalm 66:18 says if you regard iniquity in your heart the Lord will not hear your prayer. The word regard means to hold close too!
We all have struggles of our own that we take before the Lord and we all have battles with the flesh. There is a difference in those struggles than to blatantly disregard the Word of the Lord and hang onto to sin in your life! God wants His people to confess and forsake our sin!