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. (Using translation from Muslim 538a)
كُنَّا نُسَلِّمُ عَلَى رَسُولِ اللهِ ﷺ وَهُوَ فِي الصَّلَاةِ فَيَرُدَّ عَلَيْنَا فَلَمَّا رَجَعْنَا مِنْ عِنْدِ النَّجَاشِيِّ سَلَّمْنَا عَلَيْهِ فَلَمْ يَرُدَّ عَلَيْنَا فَقُلْنَا يَا رَسُولَ اللهِ كُنَّا نُسَلِّمُ عَلَيْكَ فِي الصَّلَاةِ فَتُرَدَّ عَلَيْنَا قَالَ «إِنَّ فِي الصَّلَاةِ شُغْلًا»