Precise definition of the Hilbert space in QM? In QM books (at least those I have read) the definition of the Hilbert space used is somewhat blurred (the "space of square integrable functions" is not enough to define it precisely : which kind of square integrable function ? measurables ? continuous ? something else ?..) . Ok, separable Hilbert spaces are all isometric, but in practice the choice of one representation of that isomorphic class seems important in the context of QM isn't it? So, precisely, which function space is used to represent the states of a quantum system? 
 A: Preliminary Remark. The following point of view does not follow the historical development of quantum mechanics, and this is why it is not the one adopted in most textbooks. There are few exceptions among advanced and more mathematical texts, such as Haag's "Local Quantum Physics", Bratteli-Robinson's "Operator Algebras and Quantum Statistical Mechancs", Baez-Segal-Zhou's "Introduction to Algebraic and Constructive QFT".

The choice of Hilbert space in quantum mechanics is subordinated to the choice of observables characterizing the system. This is a common feature of non-commutative probability theories, where unlike in classical probability one does not start from a sample measurable space, but rather from the set of random variables.
The minimal set of observables characterizing a physical system are the so-called canonical observables. These could be positions, momenta and spins of particles in non-relativistic theories, or (spacetime) fields and momenta in relativistic ones. Since observables can be rescaled, summed, and multiplied, it is customary to take the algebra generated by the canonical observables (i.e. all possible finite sums, products, and rescalings of canonical observables). In addition, it is convenient to consider also "complex" observables, and to introduce a notion of complex conjugation (called involution in this context). The algebras closed under involution are called *-algebras. Finally, it is also useful to give a notion of "magnitude" (norm) to a given observable, describing the maximal absolute value such observable can yield in a measurement. However, since the magnitude of the usual canonical observables is unbounded, one takes bounded functions of such observables as the generators of the algebra (customarily, the complex exponentials of the canonical observables are taken as canonical variables). Completing the *-algebra generated by the canonical observables with respect to the norm, and imposing some additional properties that are satisfied in concrete situations, one obtains a so-called C$^{\ast}$-algebra. This C$^{\ast}$-algebra is called the algebra of canonical (anti)commutation relations (CCR or CAR).
The C$^{\ast}$-algebras can usually be characterized abstractly, specifying a set of generators with given properties (from which you take linear combinations, products, involutions, and complete using the norm). The CCR and CAR algebras can be indeed characterized abstractly by a very simple set of rules on their generators (that are the complex exponentials of positons/momenta or fields/momenta).
Another important feature of C$^{\ast}$-algebras is that they can always be represented as algebras of bounded linear operators acting on some Hilbert space. This can be done explicitly, constructing the representation (and thus the Hilbert space) by means of the so-called GNS construction.
To construct the Hilbert space via GNS, one needs a state on the C$^{\ast}$-algebra. Without entering into all the details, the states are the continuous linear functionals on the algebra that preserve positivity and have norm one. The choice of state determines the representation. The pure states, for example, yield irreducible representations while the mixed state yield reducible ones.
Two representations of a given algebra are "the same" if they are equivalent, i.e. if there is a unitary map between the Hilbert spaces of the two representations, that also preserves the representation of the observables (i.e. maps a representative in the corresponding one on the other representation).
In non-relativistic quantum mechanics, all irreducible representations are equivalent (this is the Stone-von Neumann theorem). This means that the representations corresponding to all pure states are the same, and therefore correspond to the well-known Schrödinger representation where the Hilbert space is $L^2(\Omega)$, where $\Omega$ is the finite dimensional coordinate space for the particles, with the Lebesgue measure. This is why in non-relativstic quantum mechanics the Hilbert space is always taken to be the one of square-integrable functions.
In relativistic theories, there are (infinitely many) inequivalent irreducible representations of the CCR or CAR, each corresponding to different pure states. It is actually a very fundamental feature of such theories: given two pure states that are invariant with respect to the Poincaré transformations (as vacuum states should be), then either they are equal or their representations are inequivalent. This is the so-called Haag's theorem, that tells us that free and interacting theories must be on inequivalent representations of the CCR/CAR.
A: The Hilbert space of 1D quantum mechanics is constructed as the completion of the Schwartz space $\mathcal{S}(\mathbb{R})$ of smooth functions that decay faster than the inverse of any polynomial. The completion of this space is $\overline{S}(\mathbb{R})=L_2(\mathbb{R})$, the set of all Lebesgue-integrable functions with finite norm. That is, the space of measurable functions $f$ such that
$$\langle f, f\rangle=\int|f(x)|^2\mathrm{d}\mu(x)<\infty.$$
This is easily generalized to higher dimensions. Furthermore if the system in question is also equipped with a finite-dimensional degree of freedom (spin, for instance) with (finite-dimensional) Hilbert space $\mathbb{C}^n$, then the full Hilbert space becomes
$$L_2(\mathbb{R})\otimes\mathbb{C}^n.$$
I hope this helps!
