Sunan Abi Dawud Book 14, Hadith 149
When one of you is invited (to a meal), and he is fasting, he should say that he is fasting.
When one of you receives an invitation (for a meal), he should accept it. If he isn to fasting, he should eat, and if he is fasten, he should pray. Hisham said: The word salat means to pray (for him to Allah).
Abu Dawud said: This tradition has also been narrated by Hafs b. Ghiyath from Hisham.
The Prophet (ﷺ) used to observe retirement (i'tikaf) to the mosque during the last ten days of Ramadan till Allah took him, and then his wives observed retirement to the mosque after his death.