Abdullah bin Masud reported,

We used to greet the Messenger of Allah ﷺ with the salam while he was praying, and he would return our greeting. But when we returned from our visit to the Najashi, we greeted him and he did not return our greeting.We said, "Messenger of Allah, we used to greet you during prayer and you would return our greeting."He replied, "Prayer demands one's full attention."

Muslim 1201

Sahih

حدثنا أبو بكر بن أبي شيبة وزهير بن حرب وابن نمير وأبو سعيد الأشج وألفاظهم متقاربة قالوا حدثنا ابن فضيل حدثنا الأعمش عن إبراهيم عن علقمة

عن عبد الله قال

كنا نسلم على رسول الله ﷺ وهو في الصلاة فيرد علينا فلما رجعنا من عند النجاشي سلمنا عليه فلم يرد علينا فقلنا يا رسول الله كنا نسلم عليك في الصلاة فترد علينا فقال إن في الصلاة شغلا

مسلم 1201صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Prohibition of speaking during prayer and abrogation of its previous permissibility
Numbering
Darussalam 1201
Muslim 1201