If a US Citizen and an undocumented get married then leave the country how will the ten year bar be triggered if the US has no records of the illegal?

unless the undocumented spouse plans to sneak into another coutry(wherever you are going) the individual granting exit will know that that person is undocumented. So, I'd suggest you not leave