Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that he (peace and blessings be upon him) said: "When you are invited to food, accept it; if you are not fasting, eat, and if you are fasting, supplicate."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14532
Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) said that the Messenger of Allah (peace and blessings be upon him) said something with the same meaning as what Malik narrated from Nafi', but with an addition: "If he is fasting, let him supplicate, and if he is not fasting, let him eat."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14533
It was the practice of Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that when he was invited to a wedding feast (walimah), he would accept the invitation whether he was fasting or not. If he was fasting, he would supplicate for blessing, and if he was not fasting, he would eat.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14534
Ubaydullah bin Abi Yazid said: My father invited Sayyiduna Abdullah bin Umar (may Allah be pleased with them both). He came and sat down, and the food was placed. Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) put his hand toward the food and said: "Begin, saying 'Bismillah' (In the name of Allah)." Then Sayyiduna Abdullah (may Allah be pleased with him) withdrew his hand and said: "I am fasting."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14535
Muhammad bin Sirin said that his father invited a group of the Companions (may Allah be pleased with them). I think Ubayy bin Ka'b (may Allah be pleased with him) was among them. He supplicated for blessing and left.
The Shaykh (may Allah have mercy on him) said: It has already passed in earlier narrations that he was fasting; he supplicated and then left.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14536