  The prepare-and-measure scenario offers the possibility to infer the
dimension of an unknown physical system in a device-independent way, i.e. using
only raw measurement data with apparatuses regarded as black boxes. We provide
here a general lower bound on the dimension necessary to observe arbitrary
quantum behaviours in this scenario based on simple matrix analysis. This bound
holds even if the preparer and measurer share randomness. This is relevant in
scenarios were the parties are free to access this resource or it is not safe
to assume that the devices are not correlated. We further use this result to
bound the success probability of random access codes in general as a function
of the dimension of the quantum systems sent from one party to another and we
provide constructions of dimension witnesses.
