The three-dimensional (3D) incompressible flow past an open cavity in a channel is predicted using the Spalart-Almaras (SA) and the shear-stress-transport model (SST) based versions of detached eddy simulation (DES). The flow upstream of the cavity is fully turbulent. In the baseline case the length to depth (LID) ratio of the cavity is 2 and the Reynolds number Re-D=3360. Unsteady RANS (URANS) is performed to better estimate the performance of DES using the same code and meshes employed in DES. The capabilities of DES and URANS to predict the mean flow, velocity spectra, Reynolds stresses, and the temporal decay of the mass of a passive contaminant introduced instantaneously inside the cavity are assessed based on comparisons with results from a well resolved large eddy simulation (LES) simulation of the same flow conducted on a very fine mesh and with experimental data. It is found that the SA-DES simulation with turbulent fluctuations at the inlet gives the best overall predictions for the flow statistics and mass exchange coefficient characterizing the decay of scalar mass inside the cavity. The presence of inflow fluctuations in DES is found to break the large coherence of the vortices shed in the separated shear layer that are present in the simulations with steady inflow conditions and to generate a wider range of 3D eddies inside the cavity, similar to LES. The predictions of the mean velocity field from URANS and DES are similar However URANS predictions show poorer agreement with LES and experiment compared to DES for the turbulence quantities. Additionally, simulations with a higher Reynolds number (Re-D=33,600) and with a larger length to depth ratio (L/D=4) are conducted to study the changes in the flow and shear-layer characteristics, and their influence on the ejection of the passive contaminant from the cavity.