Praise be to Allah.
Abu Dawood (4180) narrated from ‘Ammaar ibn Yaasir (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “There are three whom the angels do not come near: the dead body of a kaafir, a man who smears himself with khalooq and a person who is junub, unless he does wudoo’.”
Classed as hasan by al-Albaani in Saheeh Abi Dawood
What is meant in the hadeeth is that the angels of mercy do not approach these people to bring down a blessing or mercy to them, because they are not deserving of this bounty. What is intended is to put people off their actions and the state they are in, which is a state that deserves the angels of mercy to keep away from them. This is supported by al-Bayhaqi’s version of this hadeeth in his Sunan (9241), in which it says: “There are three whom the angels do not approach with anything good…”
It was also narrated by at-Tabaraani; in his version it says, “The angels do not approach the bier of the kaafir with anything good, or one who is junub until he does ghusl or does wudoo’ as for prayer, or one who has smeared himself with sufrah (a kind of perfume).”
Fath al-Baari by Ibn Rajab, 1/360
It may be understood from the phrase “with anything good” in these two reports that what is meant is the angels of mercy whose coming signals good.
As for the angels of death and the recording angels, they are not included in this hadeeth; neither are the angels of punishment and the angels who question the person in his grave, and so on. They are not included in this hadeeth.
Al-Mannaawi (may Allah have mercy on him) said:
“There are three whom the angels do not come near” – this refers to the angels who bring down blessing and mercy, and those who go around among the people to visit and listen to dhikr, and the like, not the recording angels who do not leave those who are accountable for even an instant in all their situations, good and bad. “Not a word does he (or she) utter, but there is a watcher by him ready (to record it)” [Qaaf 50:18].
End quote from Fayd al-Qadeer, 3/428. see also Mirqaat al-Mafaateeh, 2/384
Al-Khattaabi (may Allah have mercy on him) said in his commentary on the hadeeth, “The angels do not enter a house in which there is an image or a dog or a person who is junub” – which is a da‘eef hadeeth:
The words “The angels do not enter a house…” refers to the angels who bring down blessing and mercy, not the angels who record people’s deeds, for they do not leave a person whether he is junub or otherwise.
End quote from Ma‘aalim as-Sunan, 1/75. al-Baghawi stated something similar in Sharh as-Sunnah, 2/37
Al-Bukhaari (3322) and Muslim (2106) narrated from Abu Talhah that the Prophet (blessings and peace of Allah be upon him) said: “The angels do not enter a house in which there is a dog or an image.”
An-Nawawi (may Allah have mercy on him) said:
The scholars said: The reason why they refuse to enter a house in which there is an image is the fact that it is a grievous sin and is competing with the creation of Allah, may He be exalted. And some images represent that which is worshipped instead of Allah, may He be exalted. The reason why they refuse to enter a house in which there is a dog is that dogs frequently eat impure things. And the one who keeps a dog is punished by being deprived of the angels entering his house, praying in it, asking Allah for forgiveness for him, bringing blessing to him and his household, and warding off the harm of the Shaytaan from him. As for those angels who do not enter a house in which there is a dog or an image, they are the angels who go around bringing mercy, blessing and prayers for forgiveness. As for the recording angels, they enter every house and they do not leave the sons of Adam under any circumstances, because they have been commanded to count and record their deeds.
End quote from Sharh Muslim, 7/207
Thus it becomes clear that there is no confusion in the hadeeth, if we understand it in accordance with what the scholars have stated in their commentaries on it, that the hadeeth speaks of a kind of punishment for the one who does that, in that the angels of mercy and blessing avoid the places where he is.
All of this is based on the assumption that the hadeeth is proven and saheeh. This is the view favoured by Shaykh al-Albaani (may Allah have mercy on him) and it is on this that the answer mentioned on the site previously is based.
But given that more than one of the scholars have ruled that the hadeeth is da‘eef (weak) in its chain of narration, because there is an interruption between the Sahaabi, ‘Ammaar ibn Yaasir (may Allah be pleased with him), and the one who narrated it from him, Yahya ibn Ya‘mar, because he did not hear directly from him, then in that case there is no reason for this confusion.
See: Musnad al-Imam Ahmad, ar-Risaalah edition, 31/182; an-Naafilah by Shaykh Abu Ishaaq al-Huwayni, no. 149
For more information please see the answer to question no. 147161
And Allah knows best.