StevoJH, correct. Force Z had called into Singapore, then sailed some days later to investigate and disrupt suspected Japanese landings further up the coast. They were sunk whilst returning to Singapore, having failed to make contact with IJN units. The lack of air cover or suitable escorts doomed them once they were spotted by the Japanese.
Assuming they had returned safely, they may have provided NGS support for the defences, if the Admiralty had been willing to lose them. Late in the war British X-boats tried to sink a Japanese heavy cruiser in the port, but it just settled in the shallows and remained upright (having offloaded much ammunition whilst in port prevented it actually blowing up), so there is scope to see them purposely flooded to use as a gun battery. It's hard to see them being sacrificed in this way though, as they were it for RN capital ships in the region; better to be withdrawn and kept as a stalking tiger to restrict Japanese freedom to move further west. Stuck in Singapore there would have been little hope of getting more ammunition through to them once the Japanese had started down both sides of the peninsular and they would have been subjected to daily, almost hourly bombing. Ultimately they would still have been lost as Singapore would just have fallen a bit later.