Things which may prevent du’a from being answered include:
1. When the du’a is weak in itself
Because it involves something inappropriate or involves bad manners towards Allah subhanahu wa ta’ala, or it is inappropriate, which means asking for something which is not permitted to ask. For example, when a man asks to live forever in this world, or he asks for a sin or something haram, or he prays that he will die, and so on. Abu Hurairah radhiAllahu ‘anhu said: The Messenger of Allah salAllahu ‘alayhi wa sallam said, “A person’s du’as will continue to be answered so long as he does not pray for something sinful or for the breaking of family ties.” [Muslim]
2. When the person who is making du’a is weak in himself
Because he is faint-hearted in his turning towards Allah subhanahu wa ta’ala. This may be either because of bad manners towards Allah – such as raising his voice in du’a or making du’a in the manner of one who thinks he has no need of Allah; or because he pays too much attention to the wording and tries to come up with unnecessarily ornate phrases, without paying attention to the meaning; or because he tries too hard to weep or shout without really feeling it, or he goes to extremes in that.
3. The reason why his du’a is not answered may be because he has done something that Allah has forbidden
Such as having haram wealth – whether it be food or drink or clothing or accommodation or transportation, or he has taken a haram job, or the stain of sin is still in his heart, or he is following bid’ah [innovation] in religion, or his heart has been overtaken by negligence.
4. Consuming haram wealth
This is one of the major reasons why du’as are not answered. Abu Hurairah radhiAllahu ‘anhu said: the Messenger of Allah salAllahu ‘alayhi wa sallam said:
“O people, Allah is Good and only accepts that which is good. Allah commanded the pious to follow the same commandments as He gave to the Messengers. He says (interpretation of the meaning):
‘O (you) Messengers! Eat of the Tayyibaat [all kinds of Halal (lawful) foods which Allah has made lawful] and do righteous deeds. Verily, I am Well-Acquainted with what you do,’ [al-Mu’minoon 23:51]
‘O you who believe! Eat of the lawful things that We have provided you with,’ [al-Baqarah 2:172]
Then he mentioned a man who has travelled on a long journey and is disheveled and covered with dust; he stretches forth his hands to the heaven, (saying) “O Lord, O Lord”, but his food is haram, his drink is haram, all his nourishment is haram, so how can his du’a be accepted?” [Muslim]
The man described by the Prophet salAllahu ‘alayhi wa sallam had some of the characteristics which help du’as to be answered – he was traveling and he was in need of Allah – but the fact that he consumed haram wealth prevented his du’a from being answered. We ask Allah subhanahu wa ta’ala to keep us safe and sound.
5. Trying to hasten the response
Abu Hurairah radhiAllahu ‘anhu said: the Messenger of Allah salAllahu ‘alayhi wa sallam said, “The du’a of any one of you will be answered so long as he is not impatient and says, ‘I made du’a but it was not answered.’” [al-Bukhari and Muslim]
6. Making the du’a conditional
Such as saying, “O Allah, forgive me if You will” or “O Allah, have mercy upon me if You will.” The person who makes du’a has to be resolute in his supplication, striving hard and earnestly repeating his du’a. The Prophet (salAllahu ‘alayhi wa sallam said, “Let not any one of you say, ‘O Allah, forgive me if You will, O Allah, have mercy on me if You will.’ Let him be resolute in the matter, while knowing that no one can compel Allah to do anything.” [al-Bukhari and Muslim]
In order for du’as to be answered, it is not essential to adhere to all of these points and be free of all that could prevent one’s du’as from being answered. That is something which happens very rarely. But one has to try hard and strive towards achieving this.
Another important point is to realize that the response to the du’a may take different forms: either Allah subhanahu wa ta’ala will respond and fulfill the desire of the person who made the du’a, or He will ward off some evil from him because of the du’a, or He will make something good easy for him to attain because of it, or He will save it with Him for him on the Day of Resurrection when he will be most in need of it. And Allah knows best.
Slightly modified – the original question can be read at islamqa.info