Sklearn Pipeline for mixed features: numerical and (skewed) categorical
You can use handle_unknown='ignore' in the OneHotEncoder; levels present in the test set but not the train set will be encoded as all-zeros rather than raising an error.

But... that example you provide, I rather doubt it's worth it to keep all the levels.  The coefficient learned for such a small level's dummy variable will be overly specialized (overfit).  Consider alternatives.