A court has heard television host and White Ribbon co-founder Andrew O'Keefe has been an involuntary inpatient at a Sydney hospital since allegedly assaulting his girlfriend.