Existence of a measure space with a given condition Motivated by this question and this question, among others, I wondered when can we say that there exists a measure space $(X, \mathcal{S}, \mu)$ such that
$$\operatorname{Im}(\mu) = A \cup\left\{0,+\infty\right\},$$
where $A \subset \mathbb{R}$ is a subset of the real numbers. This question may be too general, so in particular I am interested in the cases where $A = \mathbb{Q}$ and $A = \mathbb{R}\setminus \mathbb{Q}$. Thanks in advance!
 A: 
There is no measure space $(X, \mathcal{S}, \mu)$ such that
$$\operatorname{Im}(\mu) = \Bbb Q^+ \cup\left\{0,+\infty\right\}$$
(where $\Bbb Q^+$ denotes the positive rational numbers).

Proof:
Let $(X, \mathcal{S}, \mu)$ be a measure space. Suppose that $\operatorname{Im}(\mu) = \Bbb Q^+ \cup\left\{0,+\infty\right\}$.
Using a result from  Sierpinski (see for instance, this article in Wikipedia), we have that, if the image of a measure $\mu$ does not contains any interval, then for every $E \in \mathcal{S}$ such that $\mu(E)>0$, $E$ contains (at least) one atom.
Since $\operatorname{Im}(\mu) = \Bbb Q^+ \cup\left\{0,+\infty\right\}$, we can take a $E_0 \in \mathcal{S}$ such that $0<\mu(E_0)<+\infty$. Let $A_0 \subseteq E_0$ be an atom. We have that $0<\mu(A_0)  <+\infty$.
Since $\frac{1}{3}\mu(A_0) \in \Bbb Q^+$, there is $E_1 \in \mathcal{S}$ such that $\mu(E_1)= \frac{1}{3}\mu(A_0)$. Let $A_1  \subseteq E_1$ be an atom, we have that
$\mu(A_1)\leqslant \frac{1}{3}\mu(A_0)$. Since $A_0$ is an atom, we have that $\mu(A_1 \cap A_0)=0$. So we can assume without loss of generality that $A_1 \cap A_0 = \emptyset$ (if necessary, we can replace $A_1$ by $A_1\setminus (A_1 \cap A_0)$).
So by finite induction we can produce a family $\{A_n\}_{n \in \Bbb N}$ of disjoint atoms such that, for $n \in \Bbb N$,
$$\mu(A_{n+1}) \leqslant  \frac{1}{3}\mu(A_n) \tag{1}$$
Now consider the function $f: 2^{\Bbb N} \rightarrow \Bbb R$ defined by: if $N \subseteq \Bbb N$,
$$f(N)=\mu \left(\bigcup_{i \in N}A_i  \right)=\sum_{i \in N}\mu(A_i) $$
Using $(1)$, it is easy to prove that $f$ is injective (one-to-one) and since $ 2^{\Bbb N}$ is uncountable, we have that $\operatorname{Im}(f)$ is uncountable. However, it is clear that  $\operatorname{Im}(f) \subseteq \operatorname{Im}(\mu)$ and  $\operatorname{Im}(\mu)$ is countable. Contradiction.


There is no measure space $(X, \mathcal{S}, \mu)$ such that $$\operatorname{Im}(\mu) = (\Bbb R^+ \setminus \Bbb Q) \cup\left\{0,+\infty\right\}$$
(where $\Bbb R^+$ denotes the positive real numbers).

Proof:
Let $(X, \mathcal{S}, \mu)$ be a measure space. Suppose that $\operatorname{Im}(\mu) = (\Bbb R^+ \setminus \Bbb Q) \cup\left\{0,+\infty\right\}$.
By a result from  Sierpinski, we know that the image of an non-atomic measure is an interval (see for instance, this article in Wikipedia). In fact, from Sierpinski's result, we can easy prove that: if the image of a measure $\mu$ does not contains any interval, then for every $E \in \mathcal{S}$ such that $\mu(E)>0$, $E$ contains (at least) one atom.
Since $\operatorname{Im}(\mu) = (\Bbb R^+ \setminus \Bbb Q) \cup\left\{0,+\infty\right\}$, we can take a $E \in \mathcal{S}$ such that $0<\mu(E)<+\infty$. Let $A \subseteq E$ be an atom. We have that $0<\mu(A)  <+\infty$.
Now take $r\in \Bbb Q$ such that $\mu(A)< r < 2 \mu(A)$. So, we have that
$$0< r-\mu(A) <  \mu(A)$$
Since $\mu(A) \notin \Bbb Q$ and $r\in \Bbb Q$, we have that $ r-\mu(A) \in (0, +\infty) \setminus \Bbb Q^+$. So there is $B \in \mathcal{S}$, such that $\mu(B) = r-\mu(A)$.
Since $A$ is an atom and $\mu(B) < \mu(A)$, we have that $\mu(A\cap B)=0$. So
$$\mu(A \cup B) = \mu(A) + \mu(B)=  \mu(A) + r-\mu(A) = r \in \Bbb Q$$
and $r>0$.
Contradiction to the assumption that $\operatorname{Im}(\mu) = (\Bbb R^+ \setminus \Bbb Q) \cup\left\{0,+\infty\right\}$.

The cases $A = \mathbb{Q}$ and $A = \mathbb{R}\setminus \mathbb{Q}$, that is, $\operatorname{Im}(\mu) = \Bbb Q \cup\left\{0,+\infty\right\}$ and $\operatorname{Im}(\mu) = (\Bbb R \setminus \Bbb Q) \cup\left\{0,+\infty\right\}$.
We have that $\mu$ should be a signed measure. However, a signed measure must have either its negative part ($\mu^-$) or its positive ($\mu^+$) part finite.
So, there is no measure space $(X, \mathcal{S}, \mu)$ such that
$\operatorname{Im}(\mu) = \Bbb Q \cup\left\{0,+\infty\right\}$
and there is no measure space $(X, \mathcal{S}, \mu)$ such that $\operatorname{Im}(\mu) = (\Bbb R \setminus \Bbb Q) \cup\left\{0,+\infty\right\}$.
A: Thanks to Ramiro for pointing out a flaw in my original post.
I will stick with the case of measures, since this situation covers the all of the ideas. As it turns out, both cases in the question can be covered by a somewhat more general result. Using these ideas, one can probably come up with more classes of sets that aren't the ranges of measures, but I haven't yet come up with a good characterization.
Proposition: Let $A$ be dense in $\mathbb{R}$ with empty interior. Then there is no measure space $(X, \mathcal{S}, \mu)$ such that $\operatorname{Im}(\mu) = A \cup \{0, \infty\}$.
Proof: Suppose for contradiction that there is such a measure space. We will need the following claim:
Claim: For each $n \in \mathbb{N}$,
$$\sum_{\substack{E \text{ atom} \\ \mu(E) < \frac{1}{n}}} \mu(E) = \infty.$$
Assuming this claim, let $x \in \mathbb{R^{+}} \backslash A$. Since $A$ has empty interior and many sets of positive, finite measure, there are atoms with arbitrarily small measure. Using the claim with $n = 1$, we can find atoms $E_{1}, \dots, E_{m_{1}}$ such that
$$x - 1 < \sum_{k = 1}^{m_{1}} \mu(E_{k}) < x.$$
Applying the claim with $n = 2$, we can find atoms $E_{m_{1} + 1}, \dots, E_{m_{2}}$ such that
$$x - \frac{1}{2} < \sum_{k = 1}^{m_{2}} \mu(E_{k}) < x.$$
Some induction gives us atoms $E_{k}$ for $k \in \mathbb{N}$ with
$$\sum_{k = 1}^{\infty} \mu(E_{k}) = x.$$
Since the $E_{k}$'s are all atoms, the measure of their union is the sum of their measures, so
$$\mu(\cup_{k = 1}^{\infty} E_{k}) = x,$$
which is a contradiction, proving the proposition.
Proof of claim: Let $n \in \mathbb{N}$, and assume for contradiction that
$$\sum_{\substack{E \text{ atom} \\ \mu(E) < \frac{1}{n}}} \mu(E) < \infty.$$
Then there are countably many atoms $\{E_{k}\}$ with $\mu(E_{k}) < \frac{1}{n}$. Since their sum is finite, we can order the atoms such that $\mu(E_{k + 1}) \leq \mu(E_{k})$.
Let $E = \cup_{k} E_{k}$. We know that $\mu |_{X \backslash E}$ has no atoms of size smaller than $\frac{1}{n}$. Since the image of $\mu |_{X \backslash E}$ still has empty interior, we have that
$$\operatorname{Im}(\mu |_{X \backslash E}) \subseteq \{0\} \cup \bigg[\frac{1}{n}, \infty\bigg].$$
Hence, $\operatorname{Im}(\mu |_{E})$ is dense in $(0, \frac{1}{n})$. In particular, this means that for each $m > 2$,
$$\sum_{k = m}^{\infty} \mu(E_{k}) \geq \mu(E_{m - 1}).$$
Let $x \in (0, 1) \backslash \operatorname{Im}(\mu |_{E})$ be smaller than the measure of some $E_{k}$. Let $k_{1}$ be such that
$$\mu(E_{k_{1}}) < x < \mu(E_{k_{1} - 1}).$$
Find $k_{2}$ such that
$$\sum_{k = k_{1}}^{k_{2}} \mu(E_{k}) < x < \sum_{k = k_{1}}^{k_{2}} \mu(E_{k}) + \mu(E_{k_{2} + 1}).$$
This is possible since
$$\sum_{k = k_{1}}^{\infty} \mu(E_{k}) \geq \mu(E_{k_{1} - 1}) > x.$$
Find $n_{3}$ such that
$$\sum_{k = k_{1}}^{k_{2}} \mu(E_{k}) + \mu(E_{k_{3}}) < x < \sum_{k = k_{1}}^{k_{2}} \mu(E_{k}) + \mu(E_{k_{3} - 1}).$$
As for $k_{2}$, find $k_{4}$ such that
$$\sum_{k = k_{1}}^{k_{2}} \mu(E_{k}) + \sum_{k = k_{3}}^{k_{4}} \mu(E_{k}) < x < \sum_{k = k_{1}}^{k_{2}} \mu(E_{k}) + \sum_{k = k_{3}}^{k_{4}} \mu(E_{k}) + \mu(E_{k_{4} + 1}).$$
By induction, we'll end up with numbers $k_{m}$ such that
$$\sum_{m = 1}^{\infty} \sum_{k = k_{2 m - 1}}^{k_{2 m}} \mu(E_{k}) = x,$$
which is a contradiction since the union of these particular $E_{k}$'s is a set with measure $x$.
