Gauge invariance, finite temperature and parity anomaly in D = 3