Add prefix selector to flatten

This way we can keep building up the nested selector prefix chain to
arbitrary depth.