How do you define unbounded measurable functions for a general von Neumann algebra?

For the commutative algebra $L^\infty(X,\mu)$, we can consider the space of all measurable functions that are almost everywhere finite. This set has certain nice properties: it is closed under multiplication and there is the notion of convergence almost everywhere.

For the the noncommutative algebra of bounded operators on a Hilbert space, we can consider the set of all closed unbounded operators with dense domain. These operators are quite important in PDE, since differential operators are always unbounded. It is not obvious to me, however, why the product of two unbounded operators will be again a nice operator or how to generalize convergence almost everywhere to this setting.

Is there any construction like the above ones for an arbitrary von Neumann algebra? Can one get any standard properties of measurable functions from this construction?

If the closure of the spectrum of an unbounded operator $T$ is not the whole $\mathbb C$, and $z$ does not lie in this set, then we can consider instead of $T$ the resolvent $(z-T)^{-1}$, which will be a bounded operator. However, it is not clear to me how to proceed when the spectrum is the whole $\mathbb C$ or whether there is a more conceptual way to define these objects.

Update: I must have phrased the question inaccurately; the answer to the original question would be given by affiliated operators, a construction beautiful and useful, but not quite what I had in mind. I am sorry for the confusion caused (by the way, does anyone know how I can mark two answers as accepted, one for the original question and one for the rephrased one?) The rephrased question is:

For each von Neumann algebra, define canonically a set $S$ such that: * For the algebra $L^\infty(X)$, $S$ is the set of all measurable functions on $X$. * For the algebra of bounded operators on a Hilbert space, $S$ is the set of all unbounded operators on the same Hilbert space. Alternatively, explain why it impossible (or unreasonable to try) to define such a set for all von Neumann algebras. So, I wish to somehow see the set of objects that will somehow remind of unbounded operators, not to study some specific unbounded operators on given spaces. These objects need not be actual operators in any sense for an arbitrary algebra.