A registered sex offender being prosecuted for attending a baby shower event must remain in custody, a judge ruled today.