The parent to this comment said
> It works fine for songs that modulate.
By definition, modulation is the act of not remaining diatonic. Modulation = changing keys. Diatonic = staying within key.
So, no, we don't need to assume anything about diatonicity in order to successfully do harmonic analysis using Roman numerals.