It is not yet clear under what conditions empirical studies can reliably detect progress toward ecological speciation through the analysis of allelic variation at neutral loci. We use a simulation approach to investigate the range of parameter space under which such detection is, and is not, likely. We specifically test for the conditions under which divergent natural selection can cause a ‘generalized barrier to gene flow’ that is present across the genome. Our individual-based numerical simulations focus on how population divergence at neutral loci varies in relation to recombination rate with a selected locus, divergent selection on that locus, migration rate and population size. We specifically test whether genetic differences at neutral markers are greater between populations in different environments than between populations in similar environments. We find that this expected signature of ecological speciation can be detected under part of the parameter space, most consistently when divergent selection is strong and migration is intermediate. By contrast, the expected signature of ecological speciation is not reliably detected when divergent selection is weak or migration is low or high. These findings provide insights into the strengths and weaknesses of using neutral markers to infer ecological speciation in natural systems.