If you intentionally go ahead with a prayer that is invalid you will certainly be sinning, some scholars even discussed whether this is an act that makes you a kafir or not!
Why kafir? Because this person knows the ruling an nevertheless goes against it this is a meaning of kufr in Arabic which is also used in the Qur'an.
قال النووي رحمه الله: إن كان عالما بالحدث وتحريم الصلاة مع الحدث فقد ارتكب معصيةً عظيمةً، ولا يكفر عندنا بذلك، إلا أن يستحله، وقال أبو حنيفة: يكفر لاستهزائه.
دليلنا : أنه معصية فأشبهت الزنا وأشباهه
Imam an-Nawawi said (in his al-Majmu' المجموع شرح المهذب Vol. 2 page 78-79) If he knows that he is impure and that it is haraam to pray when one is impure, then he has committed a grave sin, but he does not become a kaafir thereby in our view, unless he regards that as permissible. But Abu Haneefah said: He has committed kufr because of his disrespect.
Our evidence is that it is a sin so it is akin to zina and the like.
(Source of the translation islamqa #65731)
And from the sunnah:
It was narrated from ‘Abd-Allaah ibn Mas’ood (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: “It was ordered that one of the slaves of Allaah be flogged in his grave with one hundred lashes, but he kept asking until it was reduced to a single blow. So he was given a single blow, then his grave was filled with fire. When he came round, he said: ‘Why did you flog me?’ It was said to him: ‘You offered one prayer without being taahir, and you passed by one who was being wronged and did not help him.’” Narrated by al-Tahhaawi in Mushkil al-Athaar, 4/231; classed as hasan by al-Albaani in al-Silsilah al-Saheehah, 2774. (Source of the translation islamqa #65731)
A prayer without taharah is invalid due to ahadith such as:
"Allah does not accept prayer of anyone of you if he does Hadath (passes wind) till he performs the ablution (anew). (See for example in Sahih al-Bukhari)
On the whole this is an act of disrespect of the rulings of Allah and therefore it is clearly a big sin. And one should repent from this and (of course) re-do this prayer as it is clearly invalid.
If one does so by mistake or unintentionally and find out he only needs to re-do this prayer.
My major references:
Fatwas (in Arabic) islamweb #241816 , #167217, #115529 and imam an-Nawawi's al-Majmo'.