Local compactness is not required but separability (and metrizability) seem essential for the construction below. Also, the function $L$ itself is more of a red herring: all we really need is the symmetric closed set $S=\{(x,y):L(x,y)=0\}$ in $X\times X$ disjoint with the diagonal. The condition is that $\lambda(x)\perp\lambda(y)\Longleftrightarrow (x,y)\in S$. Finally, we do not need to immediately construct $\lambda(x)$ as unit vectors; any continuous non-vanishing mapping will do because we can always normalize in the end.
Fix some dense countable subset $Z\subset X$. Put $\Omega=(X\times X)\setminus S$. For $x\in X$, define $R(x)=\operatorname{dist((x,x),S)}=\sup{r>0:(B(x,r)\times B(x,r))\cap S=\varnothing}$. Put $F_x(y)=\left(1-3\frac{d(x,y)}{R(x)}\right)_+$, $y\in X$.
Choose some Borel probability measure $\mu$ on $X$ such that the measure of every open set is strictly positive. For instance, $\mu=\sum_{x\in Z}a_x\delta_x$ for any $a_x>0$ summing up to $1$ would do nicely. Then, $X\ni x\mapsto F_x\in L^2(\mu)$ is a continuous nowhere vanishing map. Moreover, if $(x,y)\in S$, then $\langle F_x,F_y\rangle_{L^2(\mu)}=0$ because the supports are disjoint. Also, if $d(x,y'),d(x,y'')<R(x)/10$, say, we have $\langle F_{y'},F_{y''}\rangle_{L^2(\mu)}>0$ because the (open) supports of non-negative functions $F_{y'}$ and $F_{y''}$ overlap since both contain $x$.
This mapping is nice, but it has "too much" orthogonality. We want some non-zero scalar products for some faraway points too. Let's fix $(x,y)\notin S$ and consider the factor-space in which $x$ and $y$ are identified with the factor-metric. Carry out the above construction (continuity in the factor-metric implies the continuity in the original metric). Then we shall get a continuous nowhere vanishing mapping from $X$ to $L^2(\mu)$ for which we still have orthogonality on $S$ but the images of our $x$ and $y$ will have positive scalar product and the same will be true for $x',y'$ not too far away from $x,y$, where the exact size of "not too far away" is controlled by a lower bound on the distance $\operatorname{dist}((x,y),S)$ only.
Now it should be clear what to do. Just consider all pairs $x,y\in Z$ such that $(x,y)\notin S$ and the corresponding continuous mapping from $X$ to its own copy of $L^2(\mu)$ multiplied by some number $b_{x,y}>0$ with $\sum_{x,y\in Z}b_{x,y}^2<+\infty$. Then take the orthogonal sum of all these copies of $L^2(\mu)$ and the corresponding sum of the mappings.