Low gas-phase metallicities of ultraluminous infrared galaxies are a result of dust obscuration