You can but be aware that marrying to obtain an immigration benefit is marriage fraud. Marrying so soon after a petition has been denied will be a big red flag to the USCIS.
There is no limit on the ability to seek legitimate immigration benefits. I agree with my colleague that anyone who attempts to seek benefits through fraud is subject to deportation and criminal charges.