and hidden associationism—namely, ostentation (riyāʾ) and every purpose or intention lodged in the heart for anyone other than Allah.
Ostentation means performing a deed that outwardly appears to be for Allah while inwardly seeking someone else: craving people’s praise, their compliments, or any worldly advantage. In form it seems devoted to Allah, yet in fact it is directed to other than Allah, exalted is He. Allah the Exalted says: “Whoever desires the life of this world and its adornment, We shall repay them in full for their deeds therein, and they will not be deprived. Those are the ones who will have nothing in the Hereafter except the Fire; their deeds there are ruined and whatever they used to do is worthless.” (Hūd 15–16).
So if a person, for example, performs the ḥajj, seeks sacred knowledge, or undertakes any act of worship but intends by it some worldly benefit, that is ostentation, and ostentation nullifies the deed.
The Prophet (Allah bless him and grant him peace) said, “The thing I fear most for you is minor associationism.” When he was asked about it, he replied, “It is ostentation.” He also said, “Associationism in this community is more hidden than the crawling of a black ant on a black stone in the darkest night. Its expiation is to say: ‘O Allah, I seek refuge in You from associating anything with You knowingly, and I ask Your forgiveness for what I do unknowingly.’”
Therefore, it is incumbent upon the Muslim to devote his actions, words, and intentions purely to Allah, so that his deeds will be righteous and accepted by Allah Almighty.