Let $K$ be a imaginary quadratic number field which is not $ \Bbb{Q}(\sqrt{-1}), \Bbb{Q}(\sqrt{-3})$. Let $S=\{2,17\}$ be places of $K$. Let $O_{K,S} \stackrel{\mathrm{def}}{=}\{a\in K \mid v(a)\ge 0, \forall v\notin S\}$.
I want to know when $\sharp {O_{K,S}}^{\times}/{O_{K,S}^{\times}}^2=8$. This holds for $K=\Bbb{Q}(\sqrt{D})$ for $D=-3,-5,-11,-29,-37,-61,-107,-173,-317,-397,-541,-853,-2621$. according to Sage Math.
My try :
Let $S'$ be set of prime elements of $K$ above $2,17$. According to Neukirhi's $Cor 11.7$, ${O_{K,S'}}^{\times}\cong μ(K)×\Bbb{Z}^{\#S'+r+s-1}$ where $r$ is the number of real embedding, $s$ is the number of imaginary embedding, and $μ(K)$ is group of unity. In this situation, $r=0,s=1$, $μ(K)=\{±1\}$. Thus, ${O_{K,S'}}^{\times}/{O_{K,S'}^{\times}}^2 \cong \frac{\{±1\}×{\Bbb{Z}}^2}{0×2\Bbb{Z}^2}\cong (\Bbb{Z}/2\Bbb{Z})^3$
But I cannot proceed from here because I cannot find the relation between ${O_{K,S}}^{\times}/{O_{K,S}^{\times}}^2$ and ${O_{K,S'}}^{\times}/{O_{K,S'}^{\times}}^2$.
P.S
Why $2,17$ does not split implies $\sharp > {O_{K,S}}^{\times}/{O_{K,S}^{\times}}^2=8$ ?
The mistake comes from not distinguishing primes in $\mathbb{Q}$ and $\mathbb{K}$, that is, not distinguishing $S$ and $S'.$ There is no $\mathcal{O}_{\mathbb{K},S}$, this ring is only defined for prime ideals of $\mathcal{O}_\mathbb{K}$. Implicitly $\mathcal{O}_{\mathbb{K}, S} := \mathcal{O}_{\mathbb{K}, S'}$ where $S'$ is the set of primes over $S$.
While $\# S = 2$, we have $\#S' \geq 2$ depending on the splitting of $2,17$ in $\mathbb{K}$, and this is where dependence on $\mathbb{K}$ comes in.
As you rightly noted, when $2$ splits, and $17$ doesn't split, you have ${\mathcal{O}_{\mathbb{K},S'}^{\times}}/{\mathcal{O}_{\mathbb{K},S'}^{\times}}^2=16$ which comes from $\# S' = 3$. You can find similar examples where $\#S'=4$ and the order of the group becomes $32$.
In particular the result reads as $$ {\mathcal{O}_{\mathbb{K},S'}^{\times}}/{\mathcal{O}_{\mathbb{K},S'}^{\times}}^2 \cong (\Bbb{Z}/2\Bbb{Z})^{1 + \#S'} = \begin{cases}{ (\Bbb{Z}/2\Bbb{Z})^{3} \text{ if $2,17$ don't split in }\mathbb{K}, \\ (\Bbb{Z}/2\Bbb{Z})^{4} \text{ if exactly one of $2,17$ splits in }\mathbb{K}, \\ (\Bbb{Z}/2\Bbb{Z})^{5 } \text{ if both $2,17$ split in }\mathbb{K}.} \end{cases} $$