So I came to realize that with the new village mechanics in 1.14, you could now make underground villages since villagers look for beds and not doors anymore (housing with doors before 1.14 required exposed skylight so that a villager could tell what was "inside" and "outside"). With that in mind, I wondered if, when you got a bad omen, would pillagers also spawn underground to attack an underground village? I decided to test this out. I found a small cave, threw down a bed and a lectern (not really necessary but I like librarians) and spawn egged a villager in.
I then gave myself the bad omen effect, and the raid indeed came. However. They didn't spawn in the cave itself, and instead were above ground and were gathering around the X and Z position of the villager's location.
However, I then though "well maybe they didn't attack because there wasn't a lot of room underground for them". So I then made another "village" in a larger underground space (just /filled an area with air). Slapped a bed, lectern, and villager down, and lit up the area to prevent zombies from spawning. I then started another raid, but pillagers still didn't spawn underground despite the ample room and were still above ground.
Based on what I've found out, if villagers are in an enclosed underground area, they are basically immune to all raids. HOWEVER. This does not mean that the pillagers will go away. They will remain there and continue to "attempt" to reach the villager, but will never reach it unless there's an easily accessible entrance. So you'd have to dispatch of them still. There would be little-to-no risk for your villagers however as far as I'm concerned.