It is narrated from Sayyiduna Ali (may Allah be pleased with him): "Sayyiduna Jibril (peace be upon him) came to the Prophet (peace and blessings be upon him), gave the greeting of peace and then went back (without coming in). He (peace and blessings be upon him) asked: 'Why did you greet and then turn back?' He said: 'I do not enter a house in which there is an image, a dog or urine.' This situation arose because at that time a puppy (kept) by Sayyiduna al-Husayn, or Sayyiduna al-Hasan (may Allah be pleased with them both), was in the house."
I say: Imam Abu Dawud, Imam al-Nasa'i and Imam Ibn Majah recorded it in their Sunan through the route of Yahya from Sayyiduna Ali (may Allah be pleased with him) as a saying of the Prophet (marfu') with the wording: "The angels do not enter a house in which there is an image, a dog or a person in a state of sexual impurity (junub)," except that Imam Ibn Majah did not mention 'the junub'. This chain of Imam Musaddad is weak because of the weakness of Amr bin Khalid al-Qurashi.