depends on what it is. you can get surface contaminants like iron dust in the paintwork that then rusts, i used to get little spots of it.
remedy = clay bar, polish and wax
if its actual surface rust, and this will only happen if the paint has been broken and bare metal visible then something like rustex applied to the surface will seal it, kill it then touch up paint on top (if its in a non visible place.)