The dynamic interaction between a layered halfspace and quasi translationally invariant structures such as roads, railway tracks, tunnels, dams, and lifelines can be modelled using a computationally efficient 2.5D approach, assuming invariance of the geometry in the longitudinal direction. This assumption is not always fulfilled in practice, however. Even for elongated structures, full 3D computations may be required for an accurate solution of the dynamic soil-structure interaction problem. This paper presents a spatial windowing technique for elastodynamic transmission and radiation problems that allows accounting for the finite length of a structure, still maintaining the computational efficiency of a 2.5D formulation. The proposed technique accounts for the diffraction occurring at the structure's edges, but not for its modal behaviour resulting from reflections of waves at its boundaries. Numerical examples of a barrier for vibration transmission and a surface foundation are discussed to demonstrate the accuracy and applicability of the proposed methodology. Full 3D calculations are performed to provide a rigorous validation for each of these examples. It is demonstrated that the proposed technique is appropriate as long as the response is not dominated by the resonant behaviour of individual modes of the structure.