It was narrated that ‘Abdullah ibn ‘Umar said: Dogs used to urinate and come and go in the mosque, at the time of the Messenger of Allah (blessings and peace of Allah be upon him), and they did not sprinkle water on any of that..
Commentary : The urine of a dog must be purified if it gets onto the ground, or onto one’s garments and the like, just as it is enjoined to wash a vessel if a dog drinks from it. This hadith may be understood as referring to the opposite of that, because Ibn ‘Umar narrates that dogs used to urinate and come and go in the mosque at the time of the Prophet (blessings and peace of Allah be upon him), and the Sahabah (may Allah be pleased with them) did not sprinkle water on any of that. What may be understood from the hadith is that they used to urinate outside the mosque, in the places that they frequented, and they would come and go in the mosque, passing through. It is not permissible for dogs to be allowed to remain in the mosque to the point that they play about and urinate in the building. Rather they used to come and go at some times, and there were no doors or gates on the mosque to prevent the dogs from passing through. When the dogs entered the mosque, it was possible that their saliva might drop on the floor of the mosque, but it was not something definite, and it was not known where it would be. Hence the companions of the Prophet (blessings and peace of Allah be upon him) did not sprinkle water on any of that, because certainty cannot be dispelled on the basis of doubt; they were certain that the mosque was clean and pure, but they were not certain as to whether any of the dogs’ saliva was on the ground, or where it was if that had happened. The Prophet (blessings and peace of Allah be upon him) ordered that water be sprinkled over the urine of the Bedouin when he was certain that he had urinated and he knew where it was, and the urine of a dog is no less objectionable or impure (najis) than the urine of that Bedouin..