Ikhlas(sincerity) is only achievable after zuhd (asceticism), and there is no zuhd except due to taqwa (God-consciousness), and taqwa is to follow the commandments and refrain from the prohibitions.
[Majmu` al-Fatawa, Ibn Taymiyyah (1/94)]
لا يحصل الإخلاص إلا بعد الزهد