(a) Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrates: When the Messenger of Allah (peace and blessings be upon him) was in prayer, we would greet him and he would return our greeting. When we returned from the king of Abyssinia (the Negus), we greeted him but he gave us no reply. So we said: O Messenger of Allah, previously we would greet you in prayer and you would reply to us? He (peace and blessings be upon him) said: "In prayer there is preoccupation."
(b) In the narration of Abu Badr Shuja' bin al-Walid: We said: O Messenger of Allah, you used to return our greeting; why did you not return our greeting today? The Messenger of Allah (peace and blessings be upon him) said: "In prayer there is preoccupation."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3344