Separating dispersed particles from gases, air or vapours by liquid as separating agent by passing the gas or air or vapour through foam