The documentation on how indexes are stored says:
For multi-valued properties, such as ListProperty and StringListProperty, each value has its own index row, so using multi-valued properties does result in more indexing overhead.
So for each item in your list property, there is a row in the index.
My expectation would be that if there are no items in the list property, then there would be no rows in the index. So it wouldn't be possible to use the index to retrieve entities with an empty list.
One solution would be to add another property (eg hasbranches = db.BooleanProperty()
), which you maintain when you add or remove branches. Then you will be able to filter for hasbranches = False.