The Diahastsu, the Subaru Dex, and the 2nd Gen Toyota bB are all brand engineered variations of the same vehicle. It came out in 2005 originally.
They look alike as they ARE basically the same with brand-related differences, like trim, FWD vs. AWD, and engines (use one from appropriate brand). The three different companies are working together on the line. In Japan, the car companies are set up different than in the US, with many companies working together. For example, Kanto Auto Works builds the Gen 2 Scion xB (USDM)/Toyota Corolla Rumion (JDM), but also builds a range of other vehicles sold under the Toyota name:
http://www.kanto-aw.co.jp/en/products/automotiver/
If I read things correctly, Daihatsu is the primary manufacturer (and builds several other Toyota-branded products, mostly sold in Japan), with the Toyota branded and engined bB and the Subaru branded and engined Dex built on the same production line.
So, all three look VERY similar, as they ARE similar.
As for the Gen 2 Scion xB, its body is derived from the gen 2 bB, which IS also the Daihatsu. So, they look quite a bit alike.