Sampling sensitive traits in hidden populations is particularly challenging by using standard sampling methods mainly because of the lack of a sampling frame and the difficulty to obtain reliable responses. Respondent‐driven sampling is an alternative methodology that exploits the social networks between peers to reach and weight the individuals. The structure of the social contacts thus regulates the process, that can be modelled by a random walk process, by constraining the sampling within sub-regions of the network. We study the bias induced by network communities, which are groups of individuals more connected between themselves than with individuals in other groups, in the respondent‐driven sampling estimator. We simulate different social structures and individual response rates to reproduce realistic settings and also study real-life social networks. We find that the prevalence of the estimated variable is associated with the size and strength (modularity) of the network community to which the individual belongs and observe that low degree nodes may be under sampled if the sample and the network are of similar size. We also find that respondent‐driven sampling estimators perform well if response rates are relatively large and the community structure is weak, whereas low response rates typically generate strong biases irrespective of the community structure.