I have tried everything to get this villager to sleep. I've made the area bigger, made sure no beds are close, I've even tried multiple villagers, but it doesn't work. I am doing this on a realm, and it works on singleplayer creative so maybe its the realm? I've also tried different villagers to no avail.
I have a trading hall with over 80 villagers in it, and have dealt with this issue repeatedly. There are multiple bugs (that will be patched in the coming update) that cause a villager to lose their ability to reclaim a bed if they're ripped out of it by accident. On realms, this problem is made significantly worse, because you will have incredibly delayed claim times if anyone other than you is on the realm. Eventually if you lock the villager in a 1x3 cell with their bed, a blank space in front, and their workstation in front, with walls to stop them from leaving it, they will claim the bed and/or workstation as soon as the bug works itself out, and it will never break again so long as he stays in the cell. My 80 villagers have been in this format for weeks and not a single one has broken unless someone accidentally rips them out of a bed instead of trading.