You can try using a photo-transistor in binary mode: it might work, but it will be difficult to find the right component that triggers just right for your application.
Another solution is to use some component (photo-diode, photo-resistor, photo-transistor in linear region, ...) that enables to get an analog value of how much light (at the chosen wavelength) manages to pass through the air/liquid: you then measure the value with and without bubble, and set a threshold to decide if it is a bubble or not.
If you use a micro-controller (ex: Arduino), then you can read the analog voltage and process it in software.
If you prefer a binary value (without micro-controller), then a comparator + a potentiometer (or 2 fixed resistors) will enable to set the threshold and get OV/Vcc depending if you are above or bellow (ie water or bubble).
NB : if you don't have a comparator at hand, an OpAmp will also do.
To choose the LED/receptor pair, they should obviously be specified for the same wavelength. Which one? Up to you to find which one offers a big difference between air and water (pure water, or some mixture?)
For pure liquid water, there is a graph (taken from Wikipedia : https://en.wikipedia.org/wiki/Electromagnetic_absorption_by_water#/media/File:Absorption_spectrum_of_liquid_water.png)

So it would seem that the best absorption would be either in the 40-100nm range (UV, but not near the visible band), or in the 2µm to 1mm (mid and far IR) ranges (which absorbs less, but it might be easier to find LEDs/receivers).
NB: I haven't checked for the absorption spectrum of air (I suppose it is absorbing far less as it is gaseous, but best check for your chosen wavelength before buying your components).