It is narrated from Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) that he used to greet the Messenger of Allah (peace and blessings be upon him) with salam while he was praying, and he would return his greeting. Then (once) he greeted him while he was praying, and he did not respond. Sayyiduna Abdullah (may Allah be pleased with him) thought that this was due to some displeasure of the Messenger of Allah (peace and blessings be upon him). When he (peace and blessings be upon him) had finished, he said: "O Messenger of Allah, I used to greet you while you were praying and you would return my greeting; this time I greeted you and you did not respond, so I thought it was due to some displeasure with me." He (peace and blessings be upon him) said: "No, but we have been forbidden from speaking during the prayer except with the Qur'an and remembrance (dhikr)."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 10092