Over the past decade, the neutral theory of biodiversity has stirred up community assembly theory considerably by suggesting that stochasticity in the form of ecological drift is an important factor determining community composition and community turnover. The neutral theory assumes that all species within a community are functionally equivalent (the neutrality assumption), and therefore applies best to communities of trophically similar species. Evidently, trophically similar species may still differ in dispersal ability, and therefore may not be completely functionally equivalent. Here we present a new sampling formula that takes into account the partitioning of a community into two guilds that differ in immigration rate. We show that, using this sampling formula, we can accurately detect a subdivision into guilds from species abundance distributions, given ecological data about dispersal ability. We apply our sampling formula to tropical tree data from Barro Colorado Island, Panama. Tropical trees are divided depending on their dispersal mode, where biotically dispersed trees are grouped as one guild, and abiotically dispersed trees represent another guild. We find that breaking neutrality by adding guild structure to the neutral model significantly improves the fit to data and provides a better understanding of community assembly on BCI. Our findings are thus an important step towards an integration of neutral and niche theory.