You can't do this by:
just by looking at the chemical formula
But instead look up the properties of the compounds in question (Wikipedia is a good source of data).
$\text{RbOH}$ is highly soluble in water, so assuming there's an excess of water present, it will end up being dissolved in the water. So its state symbol will be $\text{(aq)}$.
Hydrogen on the other hand is a gas (at room temperature and above) and highly insoluble in water: it will leave the reaction as gas and its state symbol will be $\text{(g)}$.
So without knowing the physical/chemical properties of the reagents/reaction products, the state symbols cannot be determined.
Note that the state symbols are often idealisations: solid or liquid compounds are rarely completely soluble or completely insoluble. The same is true for gases. Even water is a case in point: liquid, $\text{(l)}$, at room temperature but with significant vapour pressure.