Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrates: We used to greet the Messenger of Allah (peace and blessings be upon him) with salam while he was in prayer, and he would return our greeting. Then, when we returned from the Negus (al-Najashi), we greeted him (peace and blessings be upon him), but he did not return our greeting. So we said: "O Messenger of Allah, we used to greet you during the prayer and you would return our greeting." He (peace and blessings be upon him) said: "Indeed, in the prayer there is an occupation."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 10090