I would have said that returning Hong Kong back to China was one of the biggest mistakes the UK has made, but here we are in 2020. It would have been better if they made it into an independent city state like Singapore.
If you don't return something at the end of a contract is that theft? or piracy? Its not like the UK had a choice. We're you expecting them to go all Hawaii on the situation and just annex it?
While China is obviously much more powerful than Guatemala, they still wouldn't have been able to invade given that it would have caused a nuclear war. Also, at that point China was much weaker economically so an economic war would have severely hurt their economic growth, undermining the key source of their power over the past 20 years.
The real issue is that HK wasn't viable without support from the mainland -- support they would have lost had this tactic been tried.
"Although not quite a piece of "barren rock" as derided by Lord Palmerston, Britain’s foreign secretary during the First Opium War, from 1839 to 1842, the fact remains that Hong Kong isn’t endowed with the necessary natural resources to support its population of 7 million. The Hong Kong special administrative region of China gets over 70 percent of its water from Dongjiang, a river in neighboring Guangdong province. Meanwhile, over 90 percent of fresh meat and vegetables consumed in Hong Kong is sourced from the mainland. And mainland energy sources generate more than half of the electricity consumed locally."[3]
They would have had to bear a massive cost, investing in desalination plants, nuclear power plants, and imported their food from elsewhere.
That cost -- while extreme -- might be looked at in hindsight as cheaper than the current outcome with the likely significant brain drain from HK.
[1] https://en.wikipedia.org/wiki/Belizean%E2%80%93Guatemalan_te...
[2] https://en.wikipedia.org/wiki/British_Army_Training_and_Supp...
[3] https://foreignpolicy.com/2014/08/21/hong-kongs-inconvenient...