According to the USCIS:
If you are applying for adjustment of status under INA section 245, and you travel anywhere outside the United States (including brief visits to Canada or Mexico) while your application is pending, USCIS will deny your Form I-485 unless:
1. Before you leave the United States, you obtain a grant of advance parole by filing Form I-131, you depart and return to a U.S. port of entry while the Advance Parole Document is valid, and you are paroled into the United States upon your return; or
2. You are an H, L, V, or K3/K4 nonimmigrant who is maintaining lawful nonimmigrant status and you return with a valid H, L, V, or K3/K4 nonimmigrant visa.
If you are applying for adjustment of status under INA section 209 because you were admitted as a refugee or granted asylum, you may travel abroad and return to the United States with a refugee travel document. You may obtain a refugee travel document by filing Form I-131 as specified in the Form I-131 Instructions. However, see Form I-131 Instructions for a travel warning regarding voluntary re-availment.
If you are applying for registry under INA section 249 and 8 CFR 249, you do not abandon your registry application by traveling abroad while it is pending. However, if you do not obtain an Advance Parole Document, you may not be able to return lawfully to the United States. You may obtain an Advance Parole Document by filing Form I-131 as specified in the Form I-131 Instructions.