Thames Water, the UK's biggest water provider, has been hit by a record fine by regulator Ofwat.