It depends a bit on what is meant by the word “hear.” It can never be argued in a literal sense that God cannot hear something. For nothing escapes God’s notice, and in no sense could He be said to be incapable of hearing a prayer.
However, if “hear” means that a prayer would be favorably received by God, that is another matter.
Generally, it would seem that God pays little heed to the prayers of unrepentant mortal sinners, though there are surely some exceptions. For example, in Scripture we read, “No, the hand of the Lord is not too short to save, / nor his ear too dull to hear. / Rather, it is your crimes that separate you from God, / It is your sins that make him hide his face / so that he does not hear you” (Is 59:1-2). Or again, “Those who shut their ears to the cry of the poor / will themselves call out and not be answered” (Prv 21:13).
So it would seem that there is a good basis for concluding that unrepentant mortal sinners are going to have a pretty hard time getting their prayers answered as they would like.
However, experience teaches that even mortal sinners do partake of many of God’s blessings. And this, too, Jesus affirms in Scripture: “The [Lord] makes his sun rise on the bad and the good, and causes rain to fall on the just and the unjust” (Mt 5:45).
How God chooses to bless or withhold blessings from the unrighteous is therefore not an all or nothing proposition, but is caught up in the mystery of His providence. Perhaps He knows a person will one day repent; perhaps He knows that an answered prayer now will help lead to repentance later. Perhaps, too, He knows that to withhold a blessing is the better course. Thus God remains sovereign in applying wisdom to each situation.
That said, we ought to remain sober about the need to pray in righteousness. For if God cannot trust us with the blessings we already have, why should He trust us with further blessings?
The First Letter of John has some advice about praying with and for those in serious sin: “If anyone sees his brother sinning, if the sin is not deadly, he should pray to God and he will give him life. This is only for those whose sin is not deadly. There is such a thing as deadly sin, about which I do not say that you should pray. All wrongdoing is sin, but there is sin that is not deadly” (5:15-17). While the instruction of John here is complex, he is saying in effect that, if we are reasonably sure that someone is in serious sin, we ought skip over praying for lesser things like a new job for them, etc. Rather the essential and only really efficacious prayer for them is to pray for their repentance. For to be dead in sins is to rather powerfully block any other blessings.
So, while God can bless even serious sinners, we ought not presuppose that He will do so and make our priority to pray for lifesaving repentance.