이 장난감이 안전한지 모르겠어요.
이 장난감이 안전한지의 여부를 모르겠어요.
The former correct. 안전한지= "if it is safe or not"
As for the latter, I'd like to change as in the following;
"이 장난감의 안전성(의) 여부를 모르겠어요." The original sentence is also correct though.
여부 is a noun meaning 'if it is A or not'.
success or failure
acceptance or rejection
Therefore, the former is focused on the unsafety and implies that the speaker is nervous about it psychologically, whereas the latter focused on measurement of the product within the criteria of safety.