I have to set room.canAnyoneDiscoverJID (default true). The equivalent of this in smack(asmack) is muc#roomconfig_whois.
Form submitForm = multiUserChat.getConfigurationForm().createAnswerForm();
submitForm.setAnswer("muc#roomconfig_publicroom", true);
submitForm.setAnswer("muc#roomconfig_persistentroom", true);
submitForm.setAnswer("muc#roomconfig_roomname", room);
submitForm.setAnswer("muc#roomconfig_whois",Arrays.asList("none"));
multiUserChat.sendConfigurationForm(submitForm);