Sahih Muslim , Hadith 1015

Abu Huraira reported Allah's Messenger as saying: O people, Allah is Good and He therefore, accepts only that which is good. And Allah commanded the believers as He commanded the Messengers by saying: "O Messengers, eat of the good things, and do good deeds; verily I am aware of what you do" (xxiii. 51). And He said: "O those who believe, eat of the good things that We gave you" (ii. 172). He then made a mention of a person who travels widely, his hair disheveled and covered with dust. He lifts his hand towards the sky (and thus makes the supplication): "O Lord, O Lord," whereas his diet is unlawful, his drink is unlawful, and his clothes are unlawful and his nourishment is unlawful. How can then his supplication be accepted?

وَحَدَّثَنِي أَبُو كُرَيْبٍ، مُحَمَّدُ بْنُ الْعَلاَءِ حَدَّثَنَا أَبُو أُسَامَةَ، حَدَّثَنَا فُضَيْلُ بْنُ مَرْزُوقٍ، حَدَّثَنِي عَدِيُّ بْنُ ثَابِتٍ، عَنْ أَبِي حَازِمٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ أَيُّهَا النَّاسُ إِنَّ اللَّهَ طَيِّبٌ لاَ يَقْبَلُ إِلاَّ طَيِّبًا وَإِنَّ اللَّهَ أَمَرَ الْمُؤْمِنِينَ بِمَا أَمَرَ بِهِ الْمُرْسَلِينَ فَقَالَ ‏{‏ يَا أَيُّهَا الرُّسُلُ كُلُوا مِنَ الطَّيِّبَاتِ وَاعْمَلُوا صَالِحًا إِنِّي بِمَا تَعْمَلُونَ عَلِيمٌ‏}‏ وَقَالَ ‏{‏ يَا أَيُّهَا الَّذِينَ آمَنُوا كُلُوا مِنْ طَيِّبَاتِ مَا رَزَقْنَاكُمْ‏}‏ ‏"‏ ‏.‏ ثُمَّ ذَكَرَ الرَّجُلَ يُطِيلُ السَّفَرَ أَشْعَثَ أَغْبَرَ يَمُدُّ يَدَيْهِ إِلَى السَّمَاءِ يَا رَبِّ يَا رَبِّ وَمَطْعَمُهُ حَرَامٌ وَمَشْرَبُهُ حَرَامٌ وَمَلْبَسُهُ حَرَامٌ وَغُذِيَ بِالْحَرَامِ فَأَنَّى يُسْتَجَابُ لِذَلِكَ ‏"‏ ‏.‏

sunnah.com