Praise be to Allaah.
What was reported in the hadeeth of Ibn Masood is that the groom should lead his bride in praying two rakahs when he goes in unto her, not immediately after the marriage contract. What you should do is pray two rakahs for istikhaarah and pray the duaa of istikhaarah before you do the marriage contract. According to the most correct opinion among the scholars, prayers for which there is a reason are allowed at times when other naafil prayers are prohibited. See question # (854).
And Allaah knows best.