Our chemistry professor said that "mg for mass, g/m3 for density, ms for time are all SI units".
I want to make sure now, even if we added a prefix to the unit, will it still be an SI unit?
Yes, when prefixes are used with coherent SI units, the resulting units are still SI units; however, they are no longer coherent.
The metre per second, symbol m/s, is the coherent SI unit of speed. The kilometre per second, km/s, the centimetre per second, cm/s, and the millimetre per second, mm/s, are also SI units, but they are not coherent SI units.