B can only attempt to hide if it is outside of an enemy's line of sight. C can see B, so B cannot attempt to hide.
I think it is a bit more interesting if C had previously hid and thus has the Invisible condition. Does the DM tell B that they cannot take the hide action because they are not out of line-of-sight from all enemies, or does the DM let B waste their action and get an automatic fail? If the DM tells B about an invisible creature, it gives away that C is present at all.
I suppose that the Invisible condition does not make a creature undetectable, so B immediately knows that an invisible creature C is in the hallway, even if B can never see C.