Sayyiduna Muhajir bin Qunfudh (may Allah be pleased with him) said: I passed by the Messenger of Allah (peace and blessings be upon him) while he was performing ablution. I greeted him with salam, but he did not reply. When he finished, he returned my greeting and apologised to me, saying: "Nothing prevented me from returning your greeting except that I disliked to mention Allah while not in a state of purity."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17912