Shortcodes wont work with that code. That code is for you to embed wherever you are showing the ads (header, sidebar etc), and encapsulating only the ad content inside the conditional.
Ie, you place the code in your theme’s header.php, just around the individual ad code (ie Google ads js).
If the Divi content is inside the post content, you can use Patron Plugin Pro’s shortcode that shows things only to non-patrons.
If the Divi content is outside the post content and instead somewhere in your theme, then you have to use the custom locking code and modify your theme’s relevant template file.