The Liouville equation with singular data: a concentration-compactness principle via a local representation formula