Would a halfling be able to squeeze past a gelatinous cube (which it states it takes up its entire space) in a 10' high and wide corridor with its Halfling Nimbleness trait? Or would the poor halfling be engulfed as it tried to dive past it?
The halfling will have to save versus Engulf
Per the Ooze's Engulf ability, other creatures can enter the space, but any that do are subject to the ability and must save at Disadvantage. This applies regardless of creature size since it's a specific beats general situation in the rules.
Halfling Nimbleness doesn't negate this. That feature's benefit relates primarily to permitting them to move through the space of an enemy who is only 1 size larger than themselves (as opposed to 2 sizes for everyone else). So were this not a gelatinous cube and instead an enemy human guard, the halfling could move through the guard's space, but an elf ally could not because the enemy is the same size as them.
It's worth noting that moving through an enemy's space is difficult terrain, so a Halfling without improvements to its speed will need to Dash to fully move through the cube's space.