This paper deals with facility location problems in a continuous space with neighbours and barriers. Each one of these two elements, neighbours and barriers, makes the problems harder than their standard counterparts. Combining all together results in a new challenging problem that, as far as we know, has not been addressed before, but has applications for inspection and surveillance activities and the delivery industry assuming uniformly distributed demand in some regions. Specifically, we analyse the k-Median problem with neighbours and polygonal barriers in two different situations. None of these problems can be seen as a simple incremental contribution since in both cases the tools required to analyse and solve them go beyond any standard overlapping of techniques used in the separated problems. As a first building block, we deal with the problem assuming that the neighbourhoods are not visible from one another and therefore there are no rectilinear paths that join two of them without crossing barriers. Under this hypothesis, we derive a valid mixed-integer linear formulation. Removing that hypothesis leads to a more general and realistic problem, but at the price of making it more challenging. Adapting the elements of the first formulation, we also develop another valid mixed-integer bilinear formulation. Both formulations rely on tools borrowed from computational geometry that allow to handle polygonal barriers and neighbours that are second-order cone (SOC) representable, which we preprocess and strengthen with valid inequalities. These mathematical programming formulations are also instrumental to derive an adapted matheuristic algorithm that provides good quality solutions for both problems in short computing time. The paper also reports extensive computational experience, counting 2400 experiments, showing that our exact and heuristic approaches are useful: the exact approach can solve optimally instances with up to 50 neighbourhoods and different number of barriers within one hour of CPU time, whereas the matheuristic approach always returns good feasible solutions in less than 300 s.