R. Kelly missed a court date this week, but had a pretty good excuse -- going under the knife ... in an operating room, not his jail cell.
Sources close to Kelly tell TMZ ... the singer was briefly taken outta MCC Chicago, and transported to a hospital earlier this week where doctors performed emergency surgery to repair a hernia. We're told he was transported back to the big house after the procedure.
We don't know how long of a hospital stay he had, but he was back in his jail cell by Thursday evening. We're told he wasn't allowed to have any visitors at the hospital.
Seems the hernia's been plaguing Kelly for a while. His lawyer filed docs back in September, outlining several medical issues facing Kelly ... including anxiety, numbness in one of his hands and the then-untreated hernia.
The Chicago Sun-Times reports Kelly is getting pain meds now, and aside from missing the court date this week -- he's also MIA from jailhouse basketball games while he's recovering.