It sounds to me like this teacher has serious problems with appropriate use of discipline, even if your kid has not told you the whole story. I can't think of any situation where making the kid sit in the hall and miss class time is an appropriate response. Unless it's a disruptive behavioral issue so serious that . . . well, that she should be doing something else, like talking to the parents. So really, I can't think of any situation where this is okay.
Thank goodness this is not the full-time gifted teacher! I would talk to the teacher, as a first step, but this may be something that needs to be taken to the principal.