The exclusive reactions $gamma p to bar K^0 K^+ n$ and $gamma p to bar K^0 K^0 p$ have been studied in the photon energy range 1.6--3.8 GeV, searching for evidence of the exotic baryon $Theta^+(1540)$ in the decays $Theta^+to nK^+$ and $Theta^+to p K^0$. Data were collected with the CLAS detector at the Thomas Jefferson National Accelerator Facility. The integrated luminosity was about 70 pb$^{-1}$. The reactions have been isolated by detecting the $K^+$ and proton directly, the neutral kaon via its decay to $K_S to pi^+ pi^-$ and the neutron or neutral kaon via the missing mass technique. The mass and width of known hyperons such as $Sigma^+$, $Sigma^-$ and $Lambda(1116)$ were used as a check of the mass determination accuracy and experimental resolution. Approximately 100,000 $Lambda^*(1520)$s and 150,000 $phi$s were observed in the $bar K^0 K^+ n$ and $bar K^0 K^0 p$ final state respectively. No evidence for the $Theta^+$ pentaquark was found in the $nK^+$ or $pK_S$ invariant mass spectra. Upper limits were set on the production cross section of the reaction $gamma p to Theta^+ bar K^0$ as functions of center-of-mass angle, $nK^+$ and $pK_S$ masses. Combining the results of the two reactions, the 95% C.L. upper limit on the total cross section for a resonance peaked at 1540 MeV was found to be 0.7 nb. Within most of the available theoretical models, this corresponds to an upper limit on the $Theta^+$ width, $Gamma_{Theta^{+}}$, ranging between 0.01 and 7 MeV.