Tripledot has already given the example of the Seminoles, but the Mexicans would be starting with far larger numbers, better weapons, and an army. The Confederacy lasted 4 years against comparable odds. Mexico lasted 4 years against the French before the US started directly supporting the Mexicans. Cuba fought for independence against Spain from 1868 to 1878, 1879 to 1880, and 1895 to 1898 before the US intervened. Annexing all of Mexico would cost far more time, money and lives than OTL's Mexican-American War. And if US will lasts long enough to finish the conquest, they will probably still have to garrison Mexico heavily for at least another decade.