I am very curious about this question. I got this doubt when I was studying anatomy and physiology of the earthworm Lampito mauritii. It breathes through its skin (cutaneous respiration) and if we cover its body with a wet cloth and all the necessary external openings are left uncovered (such as nephridia and other genital pores) then will the earthworm survive?
This is one of those speculative questions where you don't have a definite answer unless you specifically experiment and find out for yourself.
It is a known fact that earthworms breathe through diffusion. It has a thin cuticle over its body and requires moist skin which is achieved by a slimy mucous (reference). It is interesting to note that earthworms are also capable of going into a state of hibernation called estivation (in American english) (reference) which helps them maintain a low metabolic state.
Since you are planning to cover it with a cloth, the material of the cloth also matters. It has to be a material with low breathability. For eg: the survivability of the worm would depend on if you were using a wool or a silk cloth to cover it. Here is an article on the breathability of different fabrics (reference).
In conclusion, I would take a guess that it should survive if the material let air pass through and would go into a state of estivation on low availability of oxygen but maybe not die. After all, they are said to be able to survive even in water if it contains enough available oxygen. (reference).