Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
The consent of the guardian of the girl is a compulsory condition for the validity of the marriage. This is the opinion of Imam Malik, al-Shafi’e, Ahmad and the majority of Muslim scholars. This opinion is the most correct one for the Hadith that the Prophet (Sallallahu Alaihi wa Sallam) who said, “No, Nikah (marriage) is valid except with the consent of the guardian”. [Ahmad and the Imams of Sunan]
Imam Ahmad and the Imams of Sunan also reported from Ayisha (Radiya Allahu Anha) that the Prophet (Sallallahu Alaihi wa Sallam) said: “Any woman, who gets married without the consent of her Wali (guardian), her marriage is invalid, her marriage is invalid, her marriage is invalid". Narrated by Abu Dawood and al-Tirmizi”.
The above condition is made because the marriage contract is a very important and serious contract. The benefits and interests of such a contract could not be achieved except through following the rulings of Shariah.
Therefore, the mentioned contract is invalid. However, Ahnaf (one of the four Islamic schools of Jurisprudence) are of the opinion that the marriage contract with two witnesses is valid. According to them the consent of the Wali is not a compulsory condition. But the preponderant opinion is the opinion of the majority of Muslim scholars for the sound Ahadith.
Know that the separation in this case occurs only in front of a Muslim ruler or his deputy like an Islamic judge. It is better to go to an Islamic court if it is there otherwise, to any Islamic Centre to get separated legally.