All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
We hope that your question was not generated by a kind of Waswasah (devilish/obsessive whisperings). This shaved hair is most likely removed by the water when washing the body parts and does not remain attached to the skin, forming a barrier that blocks the water from reaching it, and accordingly, it does not affect the validity of ablution or Ghusl.
Assuming that the shaved hair remained attached to the face or head and prevented the water from reaching the skin, some scholars held that this falls into the category of the insignificant barrier which is excused. The Hanbali scholar Al-Buhooti regarding the dirt under the fingernails, wrote:
"There is no harm in the insignificant dirt underneath the fingernails, even if it blocks the water from reaching the skin, because it is mostly quite common. Had the ablution been considered invalid in the presence of insignificant dirt underneath the fingernails, the Prophet, sallallahu ‘alayhi wa sallam, would have clarified it, because it is not permissible to delay the clarification of an issue when it is necessary. The Shaykh (i.e. Ibn Taymiyyah ) held that the same ruling applies to any insignificant thing that prevents water from reaching the skin, like blood, dough, and the like, and he drew an analogy between that and the insignificant dirt under the fingernails." [Kashshaaf Al-Qinaa‘]
We do not know what the connection is between the issue of shaving the beard and the fact that these hairs block the water from reaching the skin. Shaving the beard is prohibited, as we have previously underlined in fatwa 84474, and there is no relation between the prohibition of shaving the beard and the fact that the place where water does not reach the skin because of these assumed hairs is excused and pardoned.
Allah knows best.