It is narrated from Sayyiduna Ibn Umar (may Allah be pleased with them both) that a man passed by the Prophet (peace and blessings be upon him) while he was urinating. The man greeted the Prophet (peace and blessings be upon him) with salam, but the Prophet (peace and blessings be upon him) did not reply to his greeting.
Related hadith on this topic