The type of prayer being prayed has a lot to do with whether God will hear and answer that prayer. The attitude of the person praying is another factor. A sinner can pray certain prayers and God will answer. We know this because we were all sinners without the holy spirit at one time. Let us look at some examples from the Scriptures and comment at the end.
In the following example, Manasseh was an evil king in Judah. He caused the inhabitants of Jerusalem to sin worse than the heathen caused their citizens to sin. God tried to get through to the Jews, but to no avail. Therefore, God brought calamity upon them. Manasseh was bound and carried to Babylon. After he was humbled, he turned to God and prayed to Him. God heard his prayers and brought him back to his kingdom in Jerusalem. Manasseh then knew that the Eternal was God. Whether this means that he was converted or not, is difficult to tell. We know that Nebuchadnezzar also came to see that God was God. However, there is little likelihood that he was converted! This is one example of a man who was evil and spurned God until he was in trouble. Then in his trouble, he sought relief and God gave it to him. He was a sinner – but his attitude changed. The bible does not tell us the words of his prayer, but no doubt, he desired relief from his bondage in Babylon and he received that relief. In this situation, God heard the prayer of an evil person of the world!
2Ch 33:9 So Manasseh made Judah and the inhabitants of Jerusalem to err, and to do worse than the heathen, whom the LORD had destroyed before the children of Israel. 10 And the LORD spake to Manasseh, and to his people: but they would not hearken. 11 Wherefore the LORD brought upon them the captains of the host of the king of Assyria, which took Manasseh among the thorns, and bound him with fetters, and carried him to Babylon. 12 And when he was in affliction, he besought the LORD his God, and humbled himself greatly before the God of his fathers, 13 And prayed unto him: and he was intreated of him, and heard his supplication, and brought him again to Jerusalem into his kingdom.
Then Manasseh knew that the LORD he was God.
One of the best examples of God hearing and answering an unconverted people's prayers with fasting, repenting and turning from their sins, was Nineveh:
Jonah 3:4 And Jonah began to enter into the city a day's journey, and he cried, and said, Yet forty days, and Nineveh shall be overthrown. 5 So the people of Nineveh believed God, and proclaimed a fast, and put on sackcloth, from the greatest of them even to the least of them. 6 For word came unto the king of Nineveh, and he arose from his throne, and he laid his robe from him, and covered him with sackcloth, and sat in ashes. 7 And he caused it to be proclaimed and published through Nineveh by the decree of the king and his nobles, saying, Let neither man nor beast, herd nor flock, taste any thing: let them not feed, nor drink water: 8 But let man and beast be covered with sackcloth, and cry mightily unto God: yea, let them turn every one from his evil way, and from the violence that is in their hands. 9 Who can tell if God will turn and repent, and turn away from his fierce anger, that we perish not? 10 And God saw their works, that they turned from their evil way; and God repented of the evil, that he had said that he would do unto them; and he did it not.
It seems that God loves to hear the prayers of the <truly> repentant, no matter who they are!
Sometimes God does not hear His own people! A person who has the holy spirit may ask something amiss, or God may be trying a person as He did Job to determine what he would do in sore trial. It is like the manufacture of a jet fighter. Once a new fighter comes out of assembly, special test pilots take it out to determine if what the designers wanted is exactly what they got! Sometimes they have disasters. A wing might fall off the aircraft. This means the designers must go back and change the design to get the product they want. The same is true with us. Sometimes God allows us to be tested to see what product He has. In such a circumstance, we may cry out for delivery but God knows that we can do better. He will not sacrifice us for a lower position in His kingdom than that for which we are capable. In these situations, God does not answer for a while – even those who have His holy spirit! Moreover, God knows when to stop the test! He will not put more on us than we can bear. But that knowledge comes to Him as He tests us.
Ps 80:4 O LORD God of hosts, how long wilt thou be angry against the prayer of thy people?
God has an acute ear to hear, and He gives regard to the prayer of the destitute. He will not despise their prayer. However, we know that thousands die daily in places such as India who are destitute. How do we answer that? The answer is that they are not praying to God, they are praying to false gods. This brings up another principle about whom God will hear. One must be praying to God or he will not hear him! Of course, there are those in this country who are destitute. Does God hear them? We do not know if they are praying! God says that you will find Me when you have sought Me with all your heart! Although, this statement could be referring to conversion, only God knows whether to answer a prayer.
Ps 102:17 He will regard the prayer of the destitute, and not despise their prayer.
We know that the prayer God really loves to hear is that of the upright. God delights in such prayers. For the upright will not ask anything amiss. They will ask God’s will to be done in their lives and in the situations they face. God hears the prayer of the righteous. Then why does the righteous not always get answers to their prayers? Sometimes we do not pray righteous prayers! If we pray according to God's will, we cannot go wrong. The righteous will not put demands on God beyond His will.
Pr 15:8 The sacrifice of the wicked is an abomination to the LORD: but the prayer of the upright is his delight.
Pr 15:29 The LORD is far from the wicked: but he heareth the prayer of the righteous.
Moreover, if a person knows the law and turns away his ear from hearing it, his prayer will be an abomination before God. An example would be a person who should know better, but acts in defiance of God's law. If that is his attitude in prayer before God, he will not be heard.
Pr 28:9 He that turneth away his ear from hearing the law, even his prayer shall be abomination.
In certain situations, God has already determined that He will not accept a prayer to Him, no matter who prays the prayer. In the Scriptures below, the Jews of Jerusalem were the people for whom God would not hear a prayer of intercession. This was no doubt for those people who were living at that time or if a prophecy, for the time of the future being cited. We need to know the Scriptures well to keep from praying for something that God has already said He will not hear.
Jer 7:16 Therefore pray not thou for this people, neither lift up cry nor prayer for them, neither make intercession to me: for I will not hear thee.
Jer 11:14 Therefore pray not thou for this people, neither lift up a cry or prayer for them: for I will not hear them in the time that they cry unto me for their trouble.
If one is asking God to cast out a demon, he needs to fast! Regardless of who he may be, there are certain demons that cannot be cast out by prayer without fasting.
Mt 17:21 Howbeit this kind goeth not out but by prayer and fasting.
One criterion to receive your requests in prayer is faith. One must believe that God will do what one asks for. A person who does not have the holy spirit may have faith for certain things. If a person is doing all he knows to do and sees a promise in the Bible, such as healing, and prays in faith believing, he could very well receive an answer to his prayer.
Mt 21:22 And all things, whatsoever ye shall ask in prayer, believing, ye shall receive.
In the following example, God heard the prayer of a man whom He was calling into the faith. He was just praying to God as he did regularly and God chose him for the faith.
Ac 10:31 And said, Cornelius, thy prayer is heard, and thine alms are had in remembrance in the sight of God.
If one is praying for the sick, faith is required. Again, the <effectual><fervent> prayer of a <righteous> man (person) avails much.