We used to greet the Messenger of Allah (ﷺ) while he was engaged in prayer and he would…

Sahih Muslim Book 5 Hadith 41

Sahih Muslim #538 a

The Book of Mosques and Places of Prayer 5:41

Abdullah (b. Masu'd) reported:

We used to greet the Messenger of Allah (ﷺ) while he was engaged in prayer and he would respond to our greeting. But when we returned from the Negus we greeted him and he did not respond to us; so we said: Messenger of Allah. we used to greet you when you were engaged in prayer and you would respond to us. He replied: Prayer demands whole attention.

Chapter: The prohibition of speaking during the prayer, and the abrogation of its former permissibility

Grade: Sahih