You raised good question on this portal.
Yoga poses are meant to be practiced on a flat, safe and comfortable surface with clear and fresh air and in a peaceful area away from noises. Yoga shastra defines time and space for doing the yoga postures. However, if you do not have space outside bed in your room, you can do it, subject to the condition as mentioned. Move out pillows and bulky comforters out of the bed and use mat instead, so that the alignment of your spine as well as limbs should not be disturbed during posture. Ensure that there should not be congestion in your room and open ventilation and fresh energy as well. The bed should be flat and should not be flexible like folding bed.
Of course, there are certain limitations while you are doing yogasanas on bed – like warm ups, and suryanamaskar and other dynamic postures which may harm the bed furniture. In this case, you can use gentle stretches while lying upwards and downwards and spinal twist on lying pose. So, choose yoga postures as per the space limitations of the bed too. You need to be very careful while doing inverted postures like headstand.
Uttanapadasana, bhujangasana, dhanurasana, chakrasana, setubandhasana, shalabhasana, pawanmuktasana, padmasana, siddhasana, vajarasana, mandukasana, kuramasana, gomukhasana, ardhmatasyendrasana, vakrasana, yogamudrasana, kukutasana, simhasana, paschhmittonasana, jaanushirshana are some of the asanas which you can practice on bed, within your body capacity, stamina and flexibility.