So I was able to tear down the packaging a bit further and find the offending cell groups. I tested directly from the battery terminals and they were the same as the BMS wire readings.
That's bad news for those groups.
If I desolder the 4 wires from the 2 cell groups would the BMS still operate or would I need a BMS with less terminals? I am ok with having reduced capacity on this battery as I don't use it much. Or would that lower the voltage too far? I think it would be pretty close to 48v with a fully charged pack.
You will need to physically bypass (short around) those cell groups with sufficient current capability to carry the full expected current of the system. The easiest way to do that without disassembling the pack is to spot weld strips across the +/- of the dead groups. Since they are already 0V dead, then it isn't going to hurt anything, there is no energy in them to short out and cause a problem.
Then you will need to "shift" all of the balance wires starting from the first dead group so the BMS is still reading consecutive groups, for the typical BMS, assuming it is capable of operating without correct voltages present at all of it's inputs. (some are, most aren't) To do this you would need to first disconnect all of the balance wires from the cells except the ones that are on the cells that are closer to the negative side than the first dead group. Then reconnect them one at a time starting at the more negative end of the connector and working your way to the most positive cell. (if you just shift them one at a time, you may end up with enough voltage across a BMS channel to damage it).
Some BMS that can be run without all balancers connected must have the unused balancers connected to each other in specific patterns, and that you'd have to find out from the BMS maker (or seller) if they have that information available. There are a very few threads scattered around here that have pictures of certain models of certain brands that show how to do this for those specific ones, but it's unlikely yours is one of them; may take more time than it is worth to locate these images to find out, as I don't know a good set of search terms likely to turn them up. Most are in battery build or repair threads.
Personally, I would replace the BMS anyway, since it allowed you to use *and charge* the pack with totally dead groups in it, which should *never* happen. Any group that is outside the safe limits should cause the BMS to completely turn off and disallow any connection to the cells from outside, to prevent further damage that can lead to a fire. If that doesn't happen, the BMS is not working and shouldn't be used.
The batteries are glued together which would make taking them apart a messy endeavor. This ebike has rear rack, and the battery is in a small box which has plenty of space so it would be no problem for me to buy some cells and glue them together/solder the leads without having to disassemble the entire battery. But would newer cells cause problems by mixing them with the aged ones?
Not directly, as long as the new cells are at least as capable as the originals, and are the same chemistry (preferably the same model).
The main issue you'll run into is that the older cells will have lower capacity and higher internal resistance, and vary more amongst each other, than the new ones, so they will fill up first before the new ones, empty first, and sag more under load. But if it still performs well enough for your usage, that doesn't matter--you just might have to leave it on the charger longer to keep it balanced to get more of it's capacity to remain usable. (assuming your BMS has a balancing function, many cheap ones don't).