The gene that codifies the beta-galactosidase enzyme is part of the <em>lac</em> operon, which also contains two other genes that produce enzymes involved in the metabolization of lactose.
Between glucose and lactose, the bacteria will preferentially use glucose as an energy source. On the other hand, lactose is a dimer, and thus a series of enzymes are needed to process lactose before its use as an energy source.
If there is no lactose present, the genes contained inside this operon are turned off (the operon is repressed).
In an absence of lactose, Lac repressor binds to <em>lac</em> operator. And as a result of this binding, transcription of <em>lac</em> operon will be prevented. Hence all the above mentioned genes of the <em>lac </em>operon will be repressed or will be turned off.