All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
We do not know of a hadeeth with this wording. However, its meaning is supported by authentic sharee'ah texts. For instance, ʻAtiyyah As-Saʻdi reported that the Prophet, sallallaahu ʻalayhi wa sallam, said, “No one will attain complete taqwa (piety and fear of Allaah) until he abandons unobjectionable (but doubtful) things so as to remain on his guard against something objectionable.” [At-Tirmithi]
It was reported on the authority of Ibn ʻUmar that the Prophet, sallallaahu ʻalayhi wa sallam, said, “A person cannot attain true taqwa without abandoning the things that he feels uneasy about in his heart.” [Al-Bukhari: Muʻallaq (a hadeeth whose reporter omits the whole chain of narrators and quotes the Prophet, sallallaahu ‘alayhi wa sallam, directly)]
An-Nuʻmaan ibn Basheer narrated that the Prophet, sallallaahu ʻalayhi wa sallam, said:
“That which is lawful is clear and that which is unlawful is clear, and between the two of them are doubtful matters about which many people do not know. Thus he who avoids doubtful matters clears himself in regard to his religion and his honor, but he who falls into doubtful matters (eventually) falls into that which is unlawful, like the shepherd who pastures around a sanctuary, all but grazing therein. Truly, every king has a sanctuary, and truly the sanctuary of Allaah is His prohibitions. Truly in the body there is a morsel of flesh, which, if it is sound, all the body is sound, and if it is diseased, all the body is diseased. Truly, it is the heart.” [Al-Bukhari and Muslim]
The scholars held different views regarding the religious ruling on committing doubtful acts; some held that it is prohibited; however, this scholarly view is refutable. Others held that it is disliked, while some refrained from declaring it lawful or unlawful.
An-Nawawi wrote, “The matters of which the scholar practicing ijtihaad (personal reasoning by competent scholars regarding cases unaddressed in the Quran and Sunnah) does not have evidence proving them to be lawful or unlawful are declared 'doubtful'. The question arises here as to whether he should hold them unlawful or lawful or should withhold of giving a judgment regarding them. Three scholarly views were cited by Al-Qaadhi ʻIyaadh and others...” [Sharh Saheeh Muslim]
Although the scholars held different views in this regard, they unanimously agreed that it is becoming of the believer who has perfect faith to avoid doubtful matters given the texts that we mentioned above.
You should know that there are levels of avoiding doubtful matters:
Firstly, doubtful matters that should be avoided because engaging in them may lead to committing prohibited ones; for example, when a man wants to marry a woman and it is doubted that she might be his suckling sister.
Secondly, doubtful matters that are originally permissible, such as the case when a man doubts divorcing his wife. The basic principle in this case is that the marriage bond is intact and that she is his wife. Certainty is not overruled by mere doubts, for mere doubts are of no legal consequences.
Thirdly, matters that are originally hanging between lawfulness and unlawfulness; it is better to avoid such matters.
Fourthly, matters of which it is recommended to avoid them, such as engaging in transactions with someone whose wealth is made up of mixed lawful and unlawful earnings.
Fifthly, matters of which it is disliked to avoid them, such as the legal concessions if someone avoids them out of being extreme in religion.
As for matters about which there is a scholarly difference of opinion, it is recommended to avoid them, according to the majority of Muslim scholars, not obligatory. The Kuwaiti Encyclopedia of Islamic Jurisprudence reads, "The majority of Muslim jurists held that it is recommended to avoid the matters about which scholars differed regarding their lawfulness (on whether they are permissible or not) and to engage in matters about which scholars differed regarding their obligation (on whether they are obligatory or not).”
Hence, engaging in a matter about which scholars held different views does not amount to prohibition and, accordingly, the person bears no sin for that.
It should be noted that avoiding the area in which there is a scholarly difference of opinion is not recommended in all cases. Ibn Taymiyyah wrote:
“Avoiding the area in which there is a scholarly difference of opinion is done out of prudence if the relevant act of Sunnah is not identified and the correct scholarly view is not authentically proved, because whoever avoids doubtful acts has preserved his religiosity and honor. However, if the doubt is eliminated and the relevant act of Sunnah is clearly identified, then there is no point in avoiding the area in which there is a scholarly difference of opinion. Therefore, it is better (for example) to perform the Witr prayer as two rakʻahs (units of prayer) followed by one rakʻah and not as a three-rakʻah prayer..... They also held that ʻAqeeqah is either recommended or obligatory although scholars held different views as to whether it is disliked ... There are many examples in this vein.....” [Sharh ʻUmdat Al-Fiqh]
Al-ʻIzz ibn ʻAbd As-Salaam wrote:
“The criterion in this regard is that if the opposing view is so weak and far from the truth, then it should not be opted for or given consideration it its evidence is not eligible to be taken as a sharee'ah evidence, especially if the ruling based on that view is to be cancelled out (with its opposite). If, on the other hand, the evidence with which the views are supported are closely strong and the opposing view is not significantly contrary to the other view, then in such case it is recommended to avoid the area in which there is a scholarly difference of opinion (and opt for the most prudent scholarly view) out of prudence that the opposing view is actually the correct one. The Islamic sharee'ah enjoins prudence pertaining to religious obligations and recommended acts just as it enjoins prudence pertaining to avoiding prohibited and disliked acts.” [Qawaaʻid Al-Ahkaam]
Allaah knows best.