In standard texts on functional analysis, something like the following is written Let $L\colon X \to Y$ where $X$ and $Y$ are both Hilbert spaces. Then the adjoint operator $L^\dagger$ exists and is unique, where $L^\dagger \colon Y \to X$ and $(Lf,g)= (f,L^\dagger g)$ for all $f \in X$ and $g \in Y$.
However, I am having some trouble with this definition in practice. When dealing with differential operators, boundary conditions have to be taken into account and invariably instead of (e.g.) $L\colon L^2 \to L^2$, we have something like $L\colon A \to L^2$ where $A$ is the subset of $L^2$ that satisfies a certain linear boundary condition like $f(1) = 0$. Since $A$ is not a closed subset, it is not a Hilbert space in its own right and I can't see that it is immediate that we can apply the standard theorem as given above. Perhaps we can extend $A$ to $L^2$ somehow - or have I completely missed the point?
By "differential operator" do you mean: the operator given by differentiation? If so, then this is very far from been defined for all $L^2$ functions-- you need to restrict to those which can be differentiated! So you're really studying an unbounded, densely defined operator. There is a lot of literature about such things-- in particular, taking adjoints does make sense, but you need some technology, and you have to be careful. – Matthew Daws Feb 22 '11 at 8:47
No you haven't missed the point. The work-around is to restrict the domain of definition of $A^{\dagger}$ to the subspace consisting of $g$'s such that $g \mapsto (Lf,g)$ is continuous. However, this is not a research-level question. You should ask this on math.stackexchange.com instead where you'll get a detailed answer. – Theo Buehler Feb 22 '11 at 8:51
I apologize for the two typos in my previous comment. It should have been $L^{\dagger}$ and $f \mapsto (Lf,g)$. You might also want to have a look at en.wikipedia.org/wiki/Unbounded_operator – Theo Buehler Feb 22 '11 at 10:31