Is there a way to measure this observable in QM? Let a quantum system be described by Hilbert space $\mathscr{H}$ and let $|\psi\rangle$ be an arbitrary state. Define the operator
$$P=|\psi\rangle\langle \psi|$$
This is hermitian. It has two eigenvalues: $0$ and $1$ with two eigenspaces. The $1$ eigenspace is the subspace spanned by $|\psi\rangle$, in other words $$\mathscr{H}_1=\{\lambda |\psi\rangle : \lambda \in \mathbb{C}\}$$
while the eigenspace corresponding to zero is its orthogonal complement $\mathscr{H}_2 = \mathscr{H}_1^\perp$.
Since this is one observable, one would expect it could be measured. But how physically such measurement can be made?
The point is that $P$ doesn't correspond directly to a physical quantity like momentum, energy or angular momentum, which one experimentalist would know of a procedure to measure in the lab.
The point is that if $A$ is one physical quantity with eigenspaces $\mathscr{H}_\lambda$ corresponding to the values $\lambda\in \sigma(A)$ the postulates of quantum mechanics allows us to say "well the system's state lies in $\mathscr{H}_\lambda$" if when we measure $A$ we get $\lambda$.
This in particular allows us to preparate a system in any eigenstate of any physical quantity that we can measure. But preparing on arbitrary states still is somewhat weird to me. 
Of course, if measuring $P$ is possible, a measure of $P$ yielding value $1$ would prepare a system in the state $|\psi\rangle$.
So, is there any "generalized way" to measure this observable?
 A: Given a description of $|\psi\rangle$, there are two possibilities. Either you know how to apply a unitary operator $U$, that maps a standard basis state that you can measure, let's say $|0\rangle$, to it or not. In either case that unitary operator, $U$ exists; so let's assume you know it too. I should also mention that computational complexity-wise, for the general case, this is a hard problem.
Assuming that you know $U$, then you can apply $U^\dagger$ to your operator:
$$Q=U^\dagger P U \ .$$
And then you can do a measurement in the standard basis. 
As a side note, let's assume in your lab or quantum computer, you can only apply a set of limited standard gates:$\left\{U_1,U_2,\cdots,U_N\right\}\in\mathcal G$. If $\mathcal G$ is universal, it is guaranteed that you can approximate any unitary operator with desired precision with its operators.
A: A measurement procedure is just a unitary operator acting on the tensor product of the system and the experimental device which entangles the two as much as possible. In the projector observable we're talking about, the outcome of measurement is either 0 or 1 so the device may consist of a single qubit with "classical" states $|0\rangle$ and $|1\rangle$ which show up on the screen of our device when we press the "big red button".
The Hamiltonian can be pretty much anything, it's a matter of engineering. We will choose it so that after time $T$, it induces the unitary evolution
$$U =(1-P) \otimes (|0\rangle\langle x| + | x\rangle\langle0|) + P \otimes(|1\rangle\langle x| + |x \rangle\langle 1|),$$
where $|x\rangle$ is the initial state of the measurement device, a state that we can reliably prepare for our device by pressing the "reset" button. One can check that $U$ is unitary. The Hamiltonian that produces this operator after time $T$ is $H = -i\hbar \log U / T$.
To make the measurement, we prepare our device in state $|x\rangle$ by pressing the reset button. Then we bring it into contact with the unknown state $|\psi_0\rangle$ for time $T$, after which the combined state has evolved to
$$U(|\psi_0\rangle \otimes |x\rangle) = (1-P)|\psi_0\rangle \otimes |0\rangle + P|\psi_0\rangle \otimes |1\rangle.$$
Then we press the big red button and now the machine either reads 0 and the state is $(1-P)|\psi_0\rangle$ (which doesn't tell us much) or the machine reads 1 and the state is $P|\psi_0\rangle \sim |\psi\rangle$, which tells us everything about the system.
You can think of this as a state preparation machine for $|\psi\rangle$ which displays 0 if unsuccessful and 1 if successful. The number of components used to implement $U$ and how many times you have to press the big red button are measures of the quantum complexity of the state $|\psi\rangle$.
I recommend John Preskill's notes (pdf) to learn (much much) more.
A: Let's say the system is in a state $|\phi\rangle$, and you want to measure said operator $P=|\psi\rangle\langle\psi|$, i.e., 
$$
\begin{align}
\langle\phi|P|\phi\rangle&=\langle\phi|\psi\rangle\langle\psi|\phi\rangle
\\
&=|\langle\phi|\psi\rangle|^2\ .
\end{align}
$$
This is, what you need to measure is the overlap of the two states.  There are different ways to do that, but the "canonical" way would be that you prepare $|\psi\rangle$ (in addition to $|\phi\rangle$, which is the input to your measurement scheme) and then let them interfere.  The degree of interference you see (when you carry out the experiment many times) will exactly correspond to 
$$
|\langle\phi|\psi\rangle|^2=
\langle\phi|P|\phi\rangle
\ .
$$
(More formally, in Quantum Information, there is the concept of a "swap test" which allows you to measure said overlap.)
A: Given $|\psi\rangle$, You can always make a machine that produces as many copies of $|\psi\rangle\langle \psi|$ pure states as required. By measuring the state copies you would be measuring the eigenspace of value $\lambda = 1$ for your observable
Measuring the eigenspace of $\lambda = 0$ is less straightforward, as it requires to determine the much bigger subspace of states orthogonal to your $|\psi\rangle$
The above procedure can be done as long as $|\psi\rangle$ is known. No-cloning theorem would forbid you from building above machine if you don't have enough information about it, and all you have is a physical instance of the quantum state
