Are there examples in scripture of God answering the prayers of unbelievers?
There are no examples we know of in scripture of unbelieving men or women praying to God and being heard. On the other hand, we do find examples of unbelievers who interact with God (in some form) like Cain – who knew of God but who lacked faith in God’s promises. These interactions are merely evidence of James’ comments regarding the acknowledgment of God but absent faith:
James 2:19 You believe that God is one. You do well; the demons also believe, and shudder.
Nevertheless, the Bible states plainly that the “prayers” (i.e., petitions) of the unbelieving world are not heard by God, because unless we approach the throne of God by way of Jesus, we have no access to the Father:
Prov. 15:29 The Lord is far from the wicked,
But He hears the prayer of the righteous.
Psa. 34:15 The eyes of the Lord are toward the righteous
And His ears are open to their cry.
Psa. 34:16 The face of the Lord is against evildoers,
To cut off the memory of them from the earth.
Psa. 34:17 The righteous cry, and the Lord hears
And delivers them out of all their troubles.
Prov. 15:8 The sacrifice of the wicked is an abomination to the Lord,
But the prayer of the upright is His delight.
Psa. 138:6 For though the Lord is exalted,
Yet He regards the lowly,
But the haughty He knows from afar.
John 14:6 Jesus said to him, “I am the way, and the truth, and the life; no one comes to the Father but through Me.
1Tim. 2:5 For there is one God, and one mediator also between God and men, the man Christ Jesus,
These scriptures and others testify that no one may pray to (or approach) the Father except in the name of Jesus. Therefore, those who do not know Christ cannot be heard since they do not approach the Father through the Son. This is the plain teaching of the Bible.
Secondly, the Bible says that men and women are born enemies of God because of the sin they inherit from Adam, but by faith in Christ we are adopted as children of God: