Try shopping for cat repellent sprays.
Also depends on the cat species, imo.
I have a ragdoll and shorthair. They were well trained. Didn't pee and spray all over.
I let them out often into the garden.
Cats kept in HDB without walk or outside exposure may get depressed.
Cats are really not indoor animals, imo.