We show how to prepare a single molecular ion in a specific internal quantum state in a situation where the molecule is trapped and sympathetically cooled by an atomic ion and where its internal degrees of freedom are initially in thermal equilibrium with the surroundings. The scheme is based on conditional creation of correlation between the internal state of the molecule and the translational state of the collective motion of the two ions, followed by a projection measurement of this collective mode by atomic ion shelving techniques. State preparation in a large number of internal states is possible.PACS numbers: 33.80. Ps,33.20.Vq,82.37.Vb Investigations of production and trapping of cold neutral and ionic molecules [1,2,3] point to a wealth of possible applications, including studies of molecular BoseEinstein condensates [4,5,6,7,8], investigations of collision and reaction dynamics at low temperature [9], high-resolution spectroscopy [10], coherent control experiments [11], and state specific reactions studies [12,13]. For much of this research, long-term localized and statespecific targets are highly desirable. One way to obtain such targets is to work with trapped molecular ions sympathetically cooled by atomic ions where previous investigations show that molecular ions can be translationally cooled to temperatures of a few mK, at which stage they become immobile and localize spatially in Coulomb crystal structures [14,15]. Though these molecules are translationally cold, studies indicate that the internal degrees of freedom of at least smaller hetero-nuclear molecules, due to their interaction with the black-body radiation (BBR), are close to be in equilibrium with the temperature of the surroundings [16]. This is not unexpected since the many order of magnitude difference between the internal transitions frequencies in the molecule ( 10 11 Hz) and the frequency of the collective vibrational modes in the Coulomb crystals ( 10 7 Hz) leads to very inefficient coupling between these degrees of freedom. Several schemes were recently proposed to cool the rotational temperature of translationally cold heteronuclear molecular ions [17,18].Here, we focus on an alternative route to the production of molecular ions in specific states. The physical system used for this purpose consists of one trapped molecular ion sympathetically cooled by a simultaneously trapped atomic ion. Such a situation was previously realized and it was shown to be possible to determine the molecular ion species non-destructively by a classical resonant excitation of one of the two axial collective modes of the two-ion system [15]. With this setup, we now propose to exploit the quantum aspect of the same collective modes to create correlations between the internal state of the molecular ion and the collective motional state in the trap potential. Previously, correlations in two-ion systems were essential in, e.g., demonstrations of quantum logical gates [19] and in a proposal for high-resolution spectroscopy [20].As depicted in Fig. 1, th...