God is sovereign and can choose to answer any prayer He sees fit. But Scripture clearly indicates that God does not listen to or answer every prayer. In fact, Scripture gives at least fifteen reasons for unanswered prayer, including having selfish motives, unbelief, unrepentant sin, rejecting God, abusing the poor, self-righteousness,  proud of heart, idolatry, hypocrisy to name a few.  More here: https://www.gty.org/library/questions/QA160/Does-God-answer-the-prayers-of-unbelievers